circuitpython/tests/basics/builtin_dict.py
stijn 3c014a67ea py: Implement __dict__ for instances.
Note that even though wrapped in MICROPY_CPYTHON_COMPAT, it is not
fully compatible because the modifications to the dictionary do not
propagate to the actual instance members.
2016-01-03 20:51:26 +02:00

12 lines
169 B
Python

class A:
def __init__(self):
self.a=1
self.b=2
try:
d=A().__dict__
print(d['a'])
print(d['b'])
except AttributeError:
print("SKIP")