When I try to assign custom attribute on object instance, AttributeError is raised:
>>> o = object()
>>> o.hi = 'mom'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'object' object has no attribute 'hi'
The same happens on most (all?) built-in types.
However, when I create instance of trivial object subclass, new property is succesfully created:
>>> class foobar(object): pass
...
>>> o = foobar()
>>> o.hi = 'mom'
>>> o.hi
'mom'
Why is that happening? Should I make my classes reject custom attributes to match object behavior? If so, how could it be done?