I can't invoke the destructor of the Parent class from the destructor of the Child class. Please, check the code below:
class BaseClass(object):
def __del__(self):
print 'BaseClass->Destructor'
class DerivativeClass(BaseClass):
def __del__(self):
print 'DerivativeClass->Destructor'
#Invoke destructor of the base class, it works
BaseClass.__del__(self)
#Doesn't work
#super(DerivativeClass, self).__del__()
instance = DerivativeClass()
When I use super(DerivativeClass, self).__del__()
in DerivativeClass.__del__()
I got the following error:
Exception TypeError: 'must be type, not None' in <bound method
DerivativeClass.__del__ of <__main__.DerivativeClass object at 0xb73a682c>> ignored
QUESTION:
Why can't I use super
in the destructor of the child class while it's perfectly fine in the constructor of the child class?