[Python-3000] auto-super()

Guido van Rossum guido at python.org
Tue Apr 18 20:53:01 CEST 2006


On 4/18/06, Michael Urman <murman at gmail.com> wrote:
> On 4/18/06, Guido van Rossum <guido at python.org> wrote:
> > Hardly the same mechanism; __private is done by low-level name
> > mangling in the early stages of the compiler. super() would need a
> > class object to be reliable; the class *name* (which is all that's
> > available at compile time) might resolve to something else at runtime.
>
> That's all the current super() gets, right? super(Base, self).meth()
> compiles with a LOAD_GLOBAL (Base)... Any mechanisms I can think of to
> solidify that into the actual class reference either rely on
> __mangled_attrs being assigned at or after class construction, or
> potentially break in inherited classes.

Sure. But that's all for anyone to see in the code. OTOH, if super
were implicit, it would be fair to expect it to do the right thing
w.r.t. the current class object. IOW an implicit super is held to a
higher standard than the current explicit super.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list