On 10/11/2013 04:33 AM, Ian Kelly wrote:

On Thu, Oct 10, 2013 at 8:11 PM, Steven D'Aprano

>One of the side-effects of this being a hack is that this doesn't work:
>
>class X(Y):
>     def method(self, arg):
>         f = super
>         f().method(arg)

Actually, that works just fine.  The compiler sees that super is
accessed within the method and creates the closure necessary to make
it work.  This does fail, however:

f = super
class X(Y):
     def method(self, arg):
         f().method(arg)

Very interesting! Thanks :)
--
Marco Buttu
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to