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/2002-February/019917.html below:

[Python-Dev] Accessing globals without dict lookup

[Python-Dev] Accessing globals without dict lookup [Python-Dev] Accessing globals without dict lookupJeremy Hylton jeremy@alum.mit.edu
Sun, 10 Feb 2002 00:01:31 -0500
You can exec a code object and specify the environment to use for
names.

Jeremy

>>> def f():
...	print x + y
... 
>>> x = 1
>>> y = 3
>>> f()
4
>>> exec f.func_code in {'x':0, 'y':-3}, {}
-3




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