R. David Murray added the comment: The behavior is deeply baked into how Python does closures and scoping. It shows up elsewhere than generators (eg: nested function definitions; usually encountered when using lambdas). So, this behavior isn't going to change, it's just one of a relatively small handful of odd things you have to learn in order to grok Python. (And yes, it is surprising...that's why there's a FAQ for it.)
---------- versions: -Python 3.2 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue7423> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com