[Python-Dev] PEP 3000 and exec

Nick Coghlan ncoghlan at gmail.com
Tue Oct 11 12:25:44 CEST 2005


Guido van Rossum wrote:
> My idea was to make the compiler smarter so that it would recognize
> exec() even if it was just a function.
> 
> Another idea might be to change the exec() spec so that you are
> required to pass in a namespace (and you can't use locals() either!).
> Then the whole point becomes moot.

I vote for the latter option. Particularly if something like Namespace objects 
make their way into the standard lib before Py3k (a Namespace object is 
essentially designed to provide attribute style lookup into a string-keyed 
dictionary- you can fake it pretty well with an empty class, but there are a 
few quirks with doing it that way).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.blogspot.com


More information about the Python-Dev mailing list