[Python-3000] PEP 3135 (New Super) - what to do?

Guido van Rossum guido at python.org
Mon Jun 11 19:00:02 CEST 2007


I'm very tempted to check in my patch even though the PEP isn't
updated (it's been renamed from PEP 367 though). Any objections?

It is python.org/sf/1727209, use the latest (topmost) super2.diff patch.

This would make the new and improved syntax super().foo(), which gets
the class and object from the current frame, as the __class__ cell and
the first argument, respectively.

Neither __class__ nor super are keywords, but the compiler spots the
use of 'super' as a free variable and makes sure the '__class__' is
available in any frame where 'super' is used.

Code is welcome to also use __class__ directly. It is set to the class
before decoration (since this is the only way that I can figure out
how to generate the code).

The old syntax super(SomeClass, self) still works; also,
super(__class__, self) is equivalent (assuming SomeClass is the
nearest lexically containing class).

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


More information about the Python-3000 mailing list