2 ms·
Python implicitly binds to the innermost scope on assignment, so you had the opposite problem when you wanted to reach a nested, non-global scope. Hence the non
by js2 15y ago
Python implicitly binds to the innermost scope on assignment, so you had the opposite problem when you wanted to reach a nested, non-global scope. Hence the nonlocal keyword added in py3k.
http://www.python.org/dev/peps/pep-3104/ http://www.python.org/dev/peps/pep-3104/