Hi,

can someone please tell me that this is correct and why:

>>> class C(object):
...     pass
...
>>> c = C()
>>> c.a = 1
>>> c.__dict__
{'a': 1}
>>> c.__dict__ = {}
>>> c.a
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'C' object has no attribute 'a'
>>>
>>> class D(object):
...     __dict__ = {}
...
>>> d = D()
>>> d.a = 1
>>> d.__dict__
{}
>>> d.__dict__ = {}
>>> d.a
1

Thanks,
Georg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to