Paul Pogonyshev wrote:
del obj.x
obj.x = y
though I'm not sure if for Python code x.__del__ will see obj.x as
non-set attribute (I guess so, but I'm not sure).
A quick experiment suggests that it does:
Python 2.5 (r25:51908, Apr 8 2007, 22:22:18)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(object):
... def __del__(self):
... print "__del__"
... print x.a
...
>>> x = Foo()
>>> x.a = Foo()
>>> del x.a
__del__
Exception exceptions.AttributeError: "'Foo' object has no attribute 'a'" in
<bound method Foo.__del__ of <__main__.Foo object at 0x6b6f0>> ignored
--
Greg
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com