[Python-3000] [Python-Dev] PEP 367: New Super

Tim Delaney timothy.c.delaney at gmail.com
Thu May 31 14:25:28 CEST 2007


Guido van Rossum wrote:
> I've updated the patch; the latest version now contains the grammar
> and compiler changes needed to make super a keyword and to
> automatically add a required parameter 'super' when super is used.
> This requires the latest p3yk branch (r55692 or higher).
>
> Comments anyone? What do people think of the change of semantics for
> the im_class field of bound (and unbound) methods?

I had problems getting the p3yK branch that I only resolved yesterday so I 
haven't actually applied the patch here yet. Turns out I'd grabbed the wrong 
URL for the repository at some point, and couldn't work out why I kept 
getting prop not found errors when trying to check out.

If I understand correctly, the patch basically takes im_class back to Python 
2.1 semantics, which I always felt were much more useful than the 2.2 
semantics. As a bonus, it should mean that the repr of a bound or unbound 
method should reflect the class it was defined in. Is this correct?

The patch notes say that you're actually inserting a keyword-only argument - 
is this purely meant to be a stopgap measure so that you've got a local 
(which could be put into a cell)? Presumably with this approach you could 
call the method like:

    A().func(1, 2, super=object())

The final implementation IMO needs to have super be an implicit local, but 
not an argument.

BTW, what made you change your mind on re-using im_class? Previously you'd 
said you didn't want to (although now I can't find the email to back that 
up). I'd written off reusing it for this purpose because of that.

I won't be able to update the PEP until Sunday (visiting family) but I'll 
try to incorporate everything we've discussed. Did we get a decision on 
whether im_class should return the decorated or undecorated class, or did 
you want me to leave that as an open issue?

I'm starting to feel somewhat embarrassed that I haven't had the time 
available to work solidly on this, but don't let that stop you from doing 
it - I'd rather have a good implementation early and not let my ego get in 
the way <wink>.

Cheers,

Tim Delaney 



More information about the Python-3000 mailing list