Is this a bug with __del__()

Greg Ewing see at my.signature
Thu May 24 22:09:42 EDT 2001


Costas Menico wrote:
> 
> I wanted to use the __del__ method in a larger example class

You should be able to design your example so that
the last reference to your instance goes away at
a predictable moment, e.g.

  print "Creating an instance"
  x = ClassFoo()
  print "Discarding the instance"
  x = None
  print "Finished"

That gives:

Creating an instance
Discarding the instance
Delete called
Finished

-- 
Greg Ewing, Computer Science Dept, University of Canterbury,	  
Christchurch, New Zealand
To get my email address, please visit my web page:	  
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list