del(instance.attr) -- no attribute

Lee Harr missive at frontiernet.net
Sun Sep 1 17:19:14 EDT 2002


Is this a bug?

>>> class C:
...  a = 1
... 
>>> c = C()
>>> c.a
1
>>> del(c.a)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: C instance has no attribute 'a'
>>> hasattr(c, 'a')
1
>>> 



I can see that maybe del(c.a) should not be allowed to delete
the attribute, but I think the error message is misleading.




More information about the Python-list mailing list