Confused about nested scopes and when names get added to namespaces

2010-09-08 Thread Russell Warren
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

Re: Confused about nested scopes and when names get added to namespaces

2010-09-08 Thread Russell Warren
My tests were run in python 2.6.5. -- http://mail.python.org/mailman/listinfo/python-list

Re: Confused about nested scopes and when names get added to namespaces

2010-09-08 Thread Emile van Sebille
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.

Re: Confused about nested scopes and when names get added to namespaces

2010-09-08 Thread Aahz
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??