micropython/tests/basics/builtin_dir.py

20 lines
282 B
Python
Raw Normal View History

# test builtin dir
# dir of locals
print('__name__' in dir())
# dir of module
import sys
print('exit' in dir(sys))
# dir of type
print('append' in dir(list))
2015-12-29 04:03:15 +00:00
class Foo:
def __init__(self):
self.x = 1
foo = Foo()
print('__init__' in dir(foo))
print('x' in dir(foo))