In article <mailman.5030.1097890551.5135.python-list at python.org>,
Ed Leafe wrote:
On Oct 15, 2004, at 7:36 PM, dataangel wrote:

What's the going argument against it? Makes sense to me.
There are constructions in other languages whereby an call to the
superclass method does not require an explicit name of the current
class. When an inherited method is augmented in a subclass, the call to
the superclass version of the method doesn't require any class
specification; each class knows its own hierarchy.
Except that in python a method can be changed to a different class, or
even multiple classes, not to mention the fact that class parents can be
dynamically reassigned.

In lanagues like Self, which is similar in its flexibility (but can
actually handle this sort of thing), the method itself inherits from the
object (it's kind of confusing to wrap your head around) so it can
figure out things like this, but Python doesn't work that way.

Think of it another way: since B can figure out how to execute a call
to a method that doesn't exist in B itself by looking into its class
hierarchy, why can't a call like self.super() execute the code that
would have been executed had the subclass not overridden the method in
the first place?
When an instance "b" (or say "c" which is an instance of class "C" which
is a subclass of "B") executes something like "self.foo", it starts
looking at the class of self. "super" actually starts further up the
chain - if self is "c", you want "A.foo" and not "B.foo" (which is what
you'd get if it tried to derive who "super" is based on "self").

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 10 of 11 | next ›
Discussion Overview
grouppython-list @
postedOct 15, '04 at 2:52p
activeOct 16, '04 at 10:11a



site design / logo © 2022 Grokbase