Hi. Is the following true? PEP227 states: """ If the global statement occurs within a block, all uses of the name specified in the statement refer to the binding of that name in the top-level namespace. """ but this is a bit ambiguous, because the global decl (I imagine for backw-compatibility) does not affect the code blocks of nested (func) definitions. So x=7 def f(): global x def g(): exec "x=3" return x print g() f() prints 3, not 7. PS: this improve backw-compatibility but the PEP is ambiguous or block concept does not imply nested definitions(?). This affects only special cases but it is quite strange in presence of nested scopes, having decl that do not extend to inner scopes.
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