super() doesn't get superclass

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Sep 19 22:00:40 EDT 2007


Hrvoje Niksic <hniksic at xemacs.org> writes:

> Ben Finney <bignose+hates-spam at benfinney.id.au> writes:
> 
> > Evan is claiming that "the next class in the MRO _is_ a superclass",
> > apparently by his definition or some other that I've not seen.
> 
> The definition of superclass is not the issue, the issue is
> "superclass *of which class*"?  You expect super(A, self) to iterate
> only over superclasses of A, even when self is an instance of a
> subtype of A.

Yes. Those are the specific parameters to the function call, so that
*is* what I expect.

> What really happens is that super(A, self) yields the next method in
> type(self)'s MRO, which can and does cause include classes that are
> not by any definition superclasses of A.

Then the function is misnamed, and implies that it does the former
("You expect ...") above, instead of the latter ("What really happens
...").

In its latter form, it is worthless to me when I'm looking for "get
superclass of A", but its name and parameters and documentation all
lead me very strongly to believe otherwise.

-- 
 \             "I put contact lenses in my dog's eyes. They had little |
  `\   pictures of cats on them. Then I took one out and he ran around |
_o__)                                   in circles."  -- Steven Wright |
Ben Finney



More information about the Python-list mailing list