Super() function



Hi,

Using Python 3.1, I sometimes use the super() function to call the equivalent method from a parent class, for example

def mymethod(self):
super().mymethod()
some more code...

Is there any way of writing the code so that the super() call is generic and automatically recognises the name of the current method (ie. something like super().thismethod()) or do I always have to repeat the method name after super()?

TIA,
Alan
.



Relevant Pages

  • Re: Re: Super() function
    ... equivalent method from a parent class, ... def mymethod: ... a look at the performance-optimised Pyrex version;) ...
    (comp.lang.python)
  • Re: instance attributes not inherited?
    ... that the parent class' __init__ is not automatically called from a subclass' __init__. ... def __init__: super.__init__ ... would create a temporary Parent object, ... Why do we need to pass self along in that call to super()? ...
    (comp.lang.python)
  • Re: Super() function
    ... equivalent method from a parent class, ... def mymethod: ... Is there any way of writing the code so that the super() call is generic and automatically recognises the name of the current method.thismethod) or do I always have to repeat the method name after super? ...
    (comp.lang.python)
  • Re: super with block
    ... through" to the parent class. ... def gsub! ...
    (comp.lang.ruby)
  • super with block
    ... through" to the parent class. ... class Nstring < String ... def gsub! ...
    (comp.lang.ruby)