When I try to dynamically add attributes to instances of object class, I get an AttributeError. However, it is possible do it with instances of subclasses of object. Does an
There is a note in the documentation about that:
http://docs.python.org/3/library/functions.html#object
Note:
objectdoes not have a__dict__, so you can’t assign arbitrary attributes to an instance of theobjectclass.
There is also a discussion about this on python mailing list:
https://mail.python.org/pipermail/python-list/2011-October/614249.html