Deleting objects with method reference

Martin martin at tv-animation.com
Wed Apr 14 04:22:04 EDT 2004


I can't delete this object after I call the Set() function.

Why is this so special, and are there any way around it besides removing the ref ?

class B:
   def __del__(self):
      print "del"
   def F(self):
      print "f"
   def Set(self):
      self.v = self.F


o1 = B()
o1.Set()
del o1


o2 = B()
o2.Set()
o2.v = None
del o2
>>> "del"


-Martin



More information about the Python-list mailing list