How do I say "two classes up in the inheritance chain" in python?
Ben Finney
bignose+hates-spam at benfinney.id.au
Tue Jan 27 04:07:26 EST 2009
Daniel Fetchinson <fetchinson at googlemail.com> writes:
> The meth methods in child1 and child2 are the same, except that in
> the last super call, one is referring to parent1, the other is
> referring to parent2.
It's important to learn that, in a language with multiple inheritance,
“superclass of this instance” is *not* the same concept as “parent
of this class”. The class you're coding may end up at any arbitrary
point in a resolution chain, despite what the class inherits from.
It's also important to be aware of the hairiness of Python's ‘super’
<URL:http://www.artima.com/weblogs/viewpost.jsp?thread=236275>.
--
\ “No matter how cynical you become, it's never enough to keep |
`\ up.” —Jane Wagner, via Lily Tomlin |
_o__) |
Ben Finney
More information about the Python-list
mailing list