1.

How Do I Call A Method Defined In A Base Class From A Derived Class That Overrides It?

Answer»

If you're using new-style CLASSES, use the built-in super() function:
class Derived(Base):
def meth (self):
super(Derived, self).meth()
If you're using classic classes: For a class DEFINITION such as class Derived(Base): ... you can call method meth() defined in Base (or one of Base's base classes) as Base.meth(self, ARGUMENTS...). Here, Base.meth is an unbound method, so you NEED to provide the self argument.

If you're using new-style classes, use the built-in super() function:
class Derived(Base):
def meth (self):
super(Derived, self).meth()
If you're using classic classes: For a class definition such as class Derived(Base): ... you can call method meth() defined in Base (or one of Base's base classes) as Base.meth(self, arguments...). Here, Base.meth is an unbound method, so you need to provide the self argument.



Discussion

No Comment Found