nested functions - access to variables?
kalmas at udm.ru
Wed Feb 26 18:40:20 CET 2003
suppose we have a program like this one:
g = 100
g = 200
g = 300
this thing prints 200 300, while i really need it to print 300 100.
When I remove 'global g', it prints 200 100, as one should expect.
If curious, the original function parses certain syntax constructing list-based
tree from it.
I do not want to pollute real global namespace with function-specific subprograms
So the question is, how to access function's variables from its nested function?
Python version is 2.2.
The other question - will there be (or already is) in Python something similar in
functionality to variant types from FPLs?
not counting different perversions with checking for None...
More information about the Python-list