[Python-3000] Fixing super anyone?

Michele Simionato michele.simionato at gmail.com
Fri Apr 20 12:07:55 CEST 2007

Guido van Rossum <guido <at> python.org> writes:
> On 4/18/07, Jim Jewett <jimjjewett <at> gmail.com> wrote:
> > Does this mean it should find the super of the current class (which
> > isn't yet defined when the method is being defined)?

> Right. It should definitely use the current class and not the name of
> the current class. I hope you'll be able to find a way to implement
> this! Perhaps the class could be gotten from a hidden cell reference,
> where the cell is filled in by the metaclass whe the class is created.
> (The cell can't represent the result of the super call, because that
> also incorporates the current value of 'self', for which you can use
> the first argument.)
> So the syntax "super" could be translated into "super(__thisclass__,
> self)" where __thisclass__ is the cell reference, self refers to the
> (current or original?) value of the first argument, and super is
> exactly the same as the 2.x super function. (Though it could be
> referenced via an opcode.)

Here is an implentation based on bytecode hacks that works in current Python:

 Michele Simionato

More information about the Python-3000 mailing list