R. David Murray added the comment:

exec is subtle.  See the explanation linked from issue 23087, which while not 
*exactly* on point explains the underlying problem (a comprehension is a new 
scope, and exec can't reach an intermediate scope the way a compiled function 
can).

As far as the difference from 2.7 goes, the scoping rules for comprehensions 
changed in python3: the variable you are concerned with is now part of the 
local scope.

----------
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
superseder:  -> Exec variable not found error

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24800>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to