[New-bugs-announce] [issue26361] lambda in dict comprehension is broken

Samuel Ainsworth report at bugs.python.org
Sun Feb 14 18:09:13 EST 2016


New submission from Samuel Ainsworth:

If we construct a dict as follows,

x = {t: lambda x: x * t for t in range(5)}

then `x[0](1)` evaluates to 4! Tested on 2.7 and 3.5.

----------
messages: 260287
nosy: Samuel.Ainsworth
priority: normal
severity: normal
status: open
title: lambda in dict comprehension is broken
type: behavior
versions: Python 2.7, Python 3.5

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


More information about the New-bugs-announce mailing list