<div dir="ltr">I think both are useful. I would make this configurable with a flag:<div><br></div><div>class MyOverridedClass(MyBaseClass):</div><div> @extendsuper(after=True)</div><div> def mymethod(self, foo):</div><div> ...</div><div><br></div><div>Or maybe a pair of decorator is a better option: @pre_super and @post_super</div></div><br><div class="gmail_quote"><div dir="ltr">El mar., 31 ene. 2017 a las 13:07, Sven R. Kunze (<<a href="mailto:srkunze@mail.de">srkunze@mail.de</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
<div class="m_7502529215214243961moz-cite-prefix gmail_msg">Hi Roberto,</div></div><div bgcolor="#FFFFFF" text="#000000" class="gmail_msg"><div class="m_7502529215214243961moz-cite-prefix gmail_msg"><br class="gmail_msg">
<br class="gmail_msg">
On 31.01.2017 08:13, Roberto Martínez wrote:<br class="gmail_msg">
</div></div><div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
<blockquote type="cite" class="gmail_msg">
<div dir="ltr" class="gmail_msg">class MyOverridedClass(MyBaseClass):
<div class="gmail_msg"> def mymethod(self, foo, **kwargs):</div>
<div class="gmail_msg"> # Do something</div>
<div class="gmail_msg"> return super().mymethod(**kwargs)</div>
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">What about creating a decorator to call super()
after/before the overrided method? Something like that:</div>
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">class MyOverridedClass(MyBaseClass):</div>
<div class="gmail_msg"> @extendsuper</div>
<div class="gmail_msg"> def mymethod(self, foo):</div>
<div class="gmail_msg"> # Do something</div>
</div>
</blockquote>
<br class="gmail_msg"></div><div bgcolor="#FFFFFF" text="#000000" class="gmail_msg">
I could find this useful. There's just on bikeshedding issue:<br class="gmail_msg">
<br class="gmail_msg">
When should "super().mymethod(**kwargs)" be called: <b class="gmail_msg">before</b>,
<b class="gmail_msg">after</b> or inbetween my specialized code?<br class="gmail_msg">
<br class="gmail_msg">
Depending on the baseclass either of those three is necessary. As
far as I can tell, we encounter all of them regularly.<br class="gmail_msg">
<br class="gmail_msg">
Best,<br class="gmail_msg">
Sven<br class="gmail_msg">
</div>
</blockquote></div>