T
tasjaevan
I seem to have stumbled across a problem with list comprehensions (or
perhaps it's a misunderstanding on my part)
[f() for f in [lambda: t for t in ((1, 2), (3, 4))]]
is giving me
[(3, 4), (3, 4)]
The equivalent using a generator expression:
[f() for f in (lambda: t for t in ((1, 2), (3, 4)))]
is giving me
[(1, 2), (3, 4)]
as expected.
Is this a known bug? I'm using Python 2.4.3
Thanks
James
perhaps it's a misunderstanding on my part)
[f() for f in [lambda: t for t in ((1, 2), (3, 4))]]
is giving me
[(3, 4), (3, 4)]
The equivalent using a generator expression:
[f() for f in (lambda: t for t in ((1, 2), (3, 4)))]
is giving me
[(1, 2), (3, 4)]
as expected.
Is this a known bug? I'm using Python 2.4.3
Thanks
James