super() doesn't get superclass
horpner at yahoo.com
Wed Sep 19 16:18:20 CEST 2007
On 2007-09-19, Michele Simionato <michele.simionato at gmail.com> wrote:
> On Sep 19, 3:22 pm, Sion Arrowsmith <si... at chiark.greenend.org.uk>
>> Ben Finney <bignose+hates-s... at benfinney.id.au> wrote:
>> > If a function is named 'super' and operates on
>> >classes, it's a pretty strong implication that it's about
>> But it doesn't (under normal circumstances) operate on classes.
>> It operates on an *instance*. And what you get back is a (proxy
>> to) a superclass/ancestor of the *instance*.
>> (And in the super(A, B) case, you get a superclass/ancestor of
>> *B*. As has just been said somewhere very near here, what is
>> misleading is the prominence of A, which isn't really the most
>> important class involved.)
> Happily A (and B too) will become invisible in Python 3000.
Nobody will miss A, but doesn't making B invisible recreate the
current mystery in a new form? We want to get rid of A because it
isn't possible to avoid repeating ourselves. But self is usually
easily available and helps define what's happening.
to me, is even more confusing.
seem like improvements. Unfortunately, neither is one of the
current alternate proposals. The closest competing proposal in
That syntax seems justified given the specialized application and
involved pitfalls of super that you disclosed in your article.
These people haven't seen the last of my face. If I go down, I'm going down
standing up. --Chuck Person
More information about the Python-list