"inherited" keyword in Python?
aleaxit at yahoo.com
Wed Dec 6 12:11:24 CET 2000
<jweirich at my-deja.com> wrote in message news:90k06d$25n$1 at nnrp1.deja.com...
> > Python has multiple inheritance, so there is (in
> general) no single
> > 'superclass' that you could use that way.
> I've heard this argument before, but am not
> convinced by it. The resolution that makes sense
> to me is to define "super.method()" to invoke the
> method that would have otherwise been invoked if
> "self.method()" were not defined in the current
Which is basically how I did it in the super(klass)
function which I presented (you do have to supply
the current-class to it, as there's no clean way
it can find out) -- super(thiclass).attribute will
find the attribute as it would be if thisclass had
an empty dictionary but the same bases (which is
simply accomplished by _building_ a class with an
empty dictionary but the same bases as thisclass:-).
But it's not a fully satisfactory solution -- others
want the equivalent of CLOS and Dylan's "call next
method", for example, and this just can't fit with
this definition of 'super'.
Again, for a better discussion of the issues, I
recommend Stroustrup's "Design and Evolution of
the C++ Programming Language". A proposal to add
a keyword 'super' to the language was brought very,
very far, close to final-approval, but finally
re-examined and abandoned because of emerging
concerns on these issues.
More information about the Python-list