[Python-Dev] New Super PEP

Calvin Spealman ironfroggy at gmail.com
Sun Apr 29 21:29:10 CEST 2007


On 4/29/07, Collin Winter <collinw at gmail.com> wrote:
> On 4/29/07, Calvin Spealman <ironfroggy at gmail.com> wrote:
> > The PEP defines the proposal to enhance the super builtin to work implicitly
> > upon the class within which it is used and upon the instance the current
> > function was called on. The premise of the new super usage suggested is as
> > follows:
> >
> >     super.foo(1, 2)
> >
> > to replace the old:
> >
> >     super(Foo, self).foo(1, 2)
>
> Now that I think about it, your proposal seems to address only one of
> super()'s three forms
> (http://docs.python.org/lib/built-in-funcs.html#l2h-72):
>
> 1. super(type)
> 2. super(type, instance)
> 3. super(type, type)
>
> If your intention is to remove the first and third forms from the
> language, please justify their removal in your PEP, including your
> proposed work-around for their use-cases.

The first is not removed, but actually utilized by the proposal
itself. That is what the __super__ attributes are: super objects
associated only with a type, but no instance.

As for the third form, I wasn't even aware of it, I thought. I didn't
consider the cases like how super is used in __new__ methods, but I
tested it with the reference implementation, and it works just fine.
If there are any cases I'm missing, there is no reason not to support
it.

-- 
Read my blog! I depend on your acceptance of my opinion! I am interesting!
http://ironfroggy-code.blogspot.com/


More information about the Python-Dev mailing list