
Barry wrote:
The ways scoping works in python is very hard to change as you are asking for i think was a major reason to reject.
Perhaps it isn't all that difficult; For instance, a "local:" declaration could be treated as if it were "def function()" with an immediately succeeding call as far as the interpreter is concerned. That buys the scoping for (nearly) free. We write... local: for MyVal in range(0,10) pass ...interpreter codes that, out of sight, as: def ghost_func_0000001(): for MyVal in range(0,10) pass ghost_func_0000001() Might take a bit of fiddling to make sure return and yield were appropriate [requiring an actual enclosing def function():], but other than that, it's basically the same idea -- provides scoping, making it easier for us to code, debug, and document, while significantly decreasing the likelihood of variable collisions. --Ben