[issue13094] setattr misbehaves when used with lambdas inside for loop

2011-10-03 Thread Tomáš Dvořák
New submission from Tomáš Dvořák dvto...@gmail.com: I have this python script, and run it in python 2.7.2 (installed from EPD_free 7.1-2 (32-bit), but I guess this has nothing to do with EPD. 8---fail.py-- class X(object): pass x = X() items = [foo, bar, baz] for each in items:

[issue13094] setattr misbehaves when used with lambdas inside for loop

2011-10-03 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Sorry. It is intended behavior. The lambda 'each' is bound to the local 'each', and by the time the lambda's execute, the value of 'each' is 'baz'. I'm going to turn this into a doc bug, because while I'm pretty sure this is