calling destructor in python multiply-inherited class

Rajorshi rajorshi at fastmail.fm
Thu May 20 06:59:08 EDT 2004


Hi,
 I have two classes, say, Base1 and Base2. Now Derv is a class derived
from both like 
class Derv(Base1,Base2).....
In the destructor of the derived class, if I write something like this

def __del__(self):
   for b in self.__class__.__bases__:
      b.__del__(self)

then its working fine, but if I am doing something straightforward
like

def __del__(self):
    Base1.__del__(self)
    Base2.__del__(self)

Its giving an error like :
Exception exceptions.AttributeError: "'NoneType' object has no
attribute '__del__'" in <bound method Derv.__del__ of <__main__.Derv
instance at 0x8187484>> ignored

Obviously I'm doing something wrong ! Any pointers ??

Thanks in advance!



More information about the Python-list mailing list