I'm having trouble understanding when variables are added to
namespaces. I thought I understood it, but my nested function
examples below have me very confused.
In each test function below I have an x variable (so x is in the
namespace of each test function). I also have a nested function in
My tests were run in python 2.6.5.
--
http://mail.python.org/mailman/listinfo/python-list
On 9/8/2010 2:18 PM Russell Warren said...
I'm having trouble understanding when variables are added to
namespaces. I thought I understood it, but my nested function
examples below have me very confused.
Take a look at PEP 227 where nested scopes are introduced.
In article d020e332-f2f2-4a82-ae1b-2ae071211...@n3g2000yqb.googlegroups.com,
Russell Warren russandheat...@gmail.com wrote:
def test4():
print running test4...
x = 1
def innerFunc():
print inner locals():,
print %s % locals() # how is x in locals in this case??