I have this code:
>>>
>>> class G:
... def __init__(self):
... self.x = 20
...
>>> gg = G()
>>> gg.x
20
>>> gg.y = 2000
and this code :
>>> from datetime import datetime
>>> my_obj = datetime.now()
>>> my_obj.interesting = 1
*** AttributeError: 'datetime.datetime' object has no attribute 'interesting'
From my python knowledge, I would say that datetime overrides setattr/getattr, but I am not sure. Could you shed some light here?
EDIT: I'm not specifically interested in datetime. I was wondering about objects in general.