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/2009-October/092776.html below:

[Python-Dev] locals() different behaviour when tracing?

[Python-Dev] locals() different behaviour when tracing? [Python-Dev] locals() different behaviour when tracing?Anders Waldenborg anders at 0x63.nu
Thu Oct 8 15:43:44 CEST 2009
Is it intentional that locals() returns a copy/snapshot of the local 
variables sometimes, and sometimes a reference? Like when enabling 
tracing, such as in the code pasted below. The documentation ("Update 
and return a dictionary containing the current scope's local 
variables.") is pretty unclear.

import sys

def X():
     l = locals()
     i = "foo"
     print "Is 'i' in stored locals()? ", ('i' in l)

print "Running normally"
X()

print "Enabling tracing"
def t(*a):
     return t
sys.settrace(t)
X()

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