[Python-ideas] A decorator to call super()

Roberto Martínez robertomartinezp at gmail.com
Tue Jan 31 02:13:15 EST 2017


Hi,

I find this type of code quite often:

class MyOverridedClass(MyBaseClass):
    def mymethod(self, foo, **kwargs):
        # Do something
        return super().mymethod(**kwargs)

What about creating a decorator to call super() after/before the overrided
method? Something like that:

class MyOverridedClass(MyBaseClass):
    @extendsuper
    def mymethod(self, foo):
        # Do something

Sorry if this has already been proposed,  I have not found anything similar
in the list.

Best regards,
Roberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170131/905c89ed/attachment.html>


More information about the Python-ideas mailing list