Message183072
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.) |
|
Date |
User |
Action |
Args |
2013-02-26 19:38:39 | r.david.murray | set | recipients:
+ r.david.murray, benjamin.peterson, bogklug, Christopher.King |
2013-02-26 19:38:39 | r.david.murray | set | messageid: <1361907519.15.0.77695181335.issue7423@psf.upfronthosting.co.za> |
2013-02-26 19:38:39 | r.david.murray | link | issue7423 messages |
2013-02-26 19:38:38 | r.david.murray | create | |
|