[Python-Dev] variable name resolution in exec is incorrect

Nick Coghlan ncoghlan at gmail.com
Thu May 27 18:08:02 CEST 2010


On 27/05/10 13:13, Greg Ewing wrote:
> The way that functions get access to names in enclosing
> local scopes is by having them passed in as cells, but that
> mechanism is only available for optimised local namespaces,
> not ones implemented as dicts.

I believe exec already includes the tapdancing needed to make that work.

As Guido pointed out, it's the ability to generate closures directly 
from a source string that is currently missing.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------


More information about the Python-Dev mailing list