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

R. David Murray report at bugs.python.org
Mon Oct 3 16:45:28 CEST 2011


R. David Murray <rdmurray at 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 documented *somewhere*, I don't see it in the programming FAQ, and it should be there.

----------
assignee:  -> docs at python
components: +Documentation -None
nosy: +docs at python, r.david.murray
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.2, Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13094>
_______________________________________


More information about the Python-bugs-list mailing list