[Python-Dev] PEP 3000 and exec (original) (raw)

Christopher Armstrong radeex at gmail.com
Tue Oct 11 02:31:09 CEST 2005


On 10/11/05, Guido van Rossum <guido at python.org> 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 think that's a great idea. It goes a step towards a more analyzable Python, and really, I've never found a good use case for allowing this invisible munging of locals. I would guess that it would simplify the implementation, given that there are currently so many special cases around exec, including when used with nested scopes.

-- Twisted | Christopher Armstrong: International Man of Twistery Radix | -- http://radix.twistedmatrix.com | Release Manager, Twisted Project \\V/// | -- http://twistedmatrix.com |o O| | w----v----w-+



More information about the Python-Dev mailing list