[Python-ideas] 'where' statement in Python?

Éric Araujo merwok at netwok.org
Tue Jul 20 23:07:06 CEST 2010


> Or allow nested list comprehensions?
> 
> [x for (x,y) in [x,f(x) for x in another_list] if y < 5]

This already works, with a syntax correction:

[x for (x, y) in [(x, f(x)) for x in another_list] if y < 5]

Regards




More information about the Python-ideas mailing list