[Python-3000] Fixing super anyone? (original) (raw)

Michele Cella michele.cella at gmail.com
Sat Apr 21 16:56:26 CEST 2007


Michele Cella wrote:

Personally, I really like this syntax: res = super currentmethod(arg, arg)

Sorry for replying to myself, what about:

def mymethod(self, arg):
    super self.mymethod(arg)

this syntax resembles very closely the way you actually invoke a self method, the only difference is that the super keyword clearly denotes that you want to call the super implementation of that method (very much like the global keyword).

So you get something like:

class Example():

    def example(self):
        # do it

    def mymethod(self, arg):
        super self.mymethod(arg)
        self.example()
    

that's all very consistent and explicit IMHO.

Ciao Michele



More information about the Python-3000 mailing list