A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-May/100370.html below:

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

[Python-Dev] variable name resolution in exec is incorrect [Python-Dev] variable name resolution in exec is incorrectGreg Ewing greg.ewing at canterbury.ac.nz
Thu May 27 01:38:50 CEST 2010
Mark Dickinson wrote:

>>>>code = """\
> 
> ... y = 3
> ... def f():
> ...     return y
> ... f()
> ... """
> 
>>>>exec code in {}   # works fine
>>>>exec code in {}, {}   # dies with a NameError

Seems to me the whole idea of being able to specify
separate global and local scopes for top-level code is
screwy in the first place. Are there any use cases for
it? Maybe the second scope argument to exec() should
be deprecated?

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4