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: http://groups.google.com/group/comp.lang.python/browse_frm/thread/a6010c7494871bb1/62a2da68961caeb6?lnk=gst&q=simionato+challenge&rnum=1&hl=en#62a2da68961caeb6 Michele Simionato _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
