super() doesn't get superclass
siona at chiark.greenend.org.uk
Wed Sep 19 15:22:22 CEST 2007
Ben Finney <bignose+hates-spam 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.)
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
"Frankly I have no feelings towards penguins one way or the other"
-- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list