[Python-3000] pyvm module - low level interface to Python's VM

Jim Jewett jimjjewett at gmail.com
Mon Dec 3 17:42:29 CET 2007


On 12/3/07, Phillip J. Eby <pje at telecommunity.com> wrote:
> At 03:48 PM 12/3/2007 +0100, Christian Heimes wrote:
> >Nick Coghlan wrote:
> > > Aren't the metaclass changes in PEP 3115 partially aimed at
> > > eliminating the need for stack frame hackery to implement
> > > these kinds of things?

Yes.

> >Couldn't we use a similar approach like the new super() magic?

In theory, yes.  As it stands, the __class__ object doesn't exist
unless there is a super call.  This was for efficiency, and more
availablility was explicitly rejected.  That said, the rejection was
for insufficient motivation, so it could change if it needs to.

> > Maybe we could introduce a similar way to access the namespace
> > of a class during its construction time?

> You can already access it with locals().  It's just that without
> _getframe, you have to do something like 'implements(locals(),
> IExample)'.

Not according to http://docs.python.org/lib/built-in-funcs.html

"""
Warning: The contents of this dictionary should not be modified;
changes may not affect the values of local variables used by the
interpreter.
"""

Given that the "correct" mapping can now be passed in as part of
construction, I *think* that restriction could be removed for class
definition.

-jJ


More information about the Python-3000 mailing list