Fredrik Lundh wrote: > in this case, > > def __del__(self): > super(self.__class__, self).__del__() > > should do the trick.
Only if nobody ever tries to subclass your class, and if they aren't going to subclass it why bother to use super in the first place. >>> class Base(object): def __del__(self): print "Base.__del__" >>> class A(Base): def __del__(self): print "A.__del__" super(self.__class__, self).__del__() >>> class B(A): def __del__(self): print "B.__del__" super(self.__class__, self).__del__() >>> a = A() >>> del a A.__del__ Base.__del__ >>> >>> b = B() >>> del b B.__del__ A.__del__ A.__del__ A.__del__ A.__del__ A.__del__ ... and so on ... I don't see any easy way to ensure that the __del__ method gets passed up the chain safely. -- http://mail.python.org/mailman/listinfo/python-list