[Python-ideas] A decorator to call super()
Sven R. Kunze
srkunze at mail.de
Tue Jan 31 07:07:52 EST 2017
More information about the Python-ideas mailing list
Tue Jan 31 07:07:52 EST 2017
- Previous message (by thread): [Python-ideas] A decorator to call super()
- Next message (by thread): [Python-ideas] A decorator to call super()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Roberto, On 31.01.2017 08:13, Roberto MartÃnez wrote: > 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 I could find this useful. There's just on bikeshedding issue: When should "super().mymethod(**kwargs)" be called: *before*, *after* or inbetween my specialized code? Depending on the baseclass either of those three is necessary. As far as I can tell, we encounter all of them regularly. Best, Sven -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170131/1b27b0e2/attachment.html>
- Previous message (by thread): [Python-ideas] A decorator to call super()
- Next message (by thread): [Python-ideas] A decorator to call super()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-ideas mailing list