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/2001-March/013362.html below:

[Python-Dev] violently deprecating exec without in (was: nested scopes. global: have I got it right?)

[Python-Dev] violently deprecating exec without in (was: nested scopes. global: have I got it right?) [Python-Dev] violently deprecating exec without in (was: nested scopes. global: have I got it right?)Guido van Rossum guido@digicool.com
Thu, 01 Mar 2001 21:43:34 -0500
> >   SP> # top-level
> >   SP> def g():
> >   SP>   exec "x=3" 
> >   SP>   return x

[me]
> Unfortunately this used to work, using a gross hack: when an exec (or
> import *) was present inside a function, the namespace semantics *for
> that function* was changed to the pre-0.9.1 semantics, where all names
> are looked up *at run time* first in the locals then in the globals
> and then in the builtins.
> 
> I don't know how common this is -- it's pretty fragile.  If there's a
> great clamor, we can put this behavior back after b1 is released.

I spoke too soon.  It just works in the latest 2.1b1.  Or am I missing
something?

--Guido van Rossum (home page: http://www.python.org/~guido/)



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