[EMAIL PROTECTED] writes:
> 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))]]

List comprehensions are syntactic sugar for "for" loops.  The
thing to notice is that in "lambda: t", t is unbound.  It's not
the same as the loop index inside the list comp.  Try:

   [f() for f in [lambda t=t: t for t in ((1, 2), (3, 4))]]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to