Micropython:
>>> class Foo:
... pass
>>> t = Foo()
>>> t.__dict__
{}
>>> t.__dict__['a'] = 4
>>> t.__dict__
{}
>>> t.a
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Foo' object has no attribute 'a'
Python3:
>>> class Foo:
... pass
...
>>> t = Foo()
>>> t.__dict__
{}
>>> t.__dict__['a'] = 4
>>> t.__dict__
{'a': 4}
>>> t.a
4
Same applies for t.__dict__.update(another_dict)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4