Why is it possible to dynamically define a new attribute for every class instance in Python as long as it's not of type object
?
class NewStyle(object):
pass
class OldStyle:
pass
a = object()
# This line raises AttributeError
a.foo = 1
# All of these work fine
a = Exception()
a.foo = 1
a = OldStyle()
a.foo = 1
a = NewStyle()
a.foo = 1
This behaviour seems to be identical in Python 3