How do I define a __del__ method for an object?

Stewart Midwinter stewartNO at
Sun Mar 7 20:31:32 CET 2004

I was looking through Swaroop's tutorial, "A Byte of Python", on Python 
objects,(, and he mentions that you can 
define a __del__ function to completely delete object instances. 
However, when I try to define one in the attached script, not just one, 
but all, of the defined objects disappear.

Can someone show me how to define a __del__ object that works on only 
one object instance?

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
URL: <>

More information about the Python-list mailing list