[Python-3000] super (was: Removing __var)
Jim Jewett
jimjjewett at gmail.com
Mon Oct 2 01:07:19 CEST 2006
On 10/1/06, Guido van Rossum <guido at python.org> wrote:
> But I'm all for adding syntactic sugar to Py3k. Can someone please
> draft a proto-PEP? I think the compiler could treat super as a
> reserved word and turn super.foo(args) into __super__(<thisclass>,
> self).foo(args).
Are you saying that it would be OK to peek inside the function at
compile-time and capture self.__class__ then, rather than waiting for
run-time (when self might really be a subclass instance)?
On its own that seems reasonable, but the "peek early" proposals are
starting to add up, and they aren't all consistent.
The stuff inside a function definition doesn't get evaluated until
the function is called.
Except that if it has "yield", that changes the compiler settings.
Nothing gets evalated, we just peek.
And a switch creation does get evaluated early (if that happens).
And a static/once/final variable gets evaluated early (to line up
with switch)
And a super gets created early, but only halfway. It freezes
self.__class__, but not the self.__mro__
-jJ
More information about the Python-3000
mailing list