New submission from Lukas Petru <lukas.pe...@seznam.cz>: Can "nonlocal x" declaration also reference global x? I would assume that global scope automatically encloses all other scopes. But the nonlocal keyword seems to exclude global scope. This seems counter-intuitive. (maybe bug in implementation?)
For example: x=0 def count(i): nonlocal x; x+=i; return x; Checking this code in IDLE gives: no binding for nonlocal 'x' found. If this is what was intended, maybe it should be more clearly written in the documentation. I am coming to Python from Lisp, so I am still learning Python's principles. ---------- components: Interpreter Core messages: 136722 nosy: Lukas.Petru priority: normal severity: normal status: open title: Does nonlocal include global? type: behavior versions: Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12165> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com