[Python-ideas] "While" suggestion
Boris Borcic
bborcic at gmail.com
Wed Aug 20 14:37:22 CEST 2008
Andrew Toulouse wrote:
> If I'm understanding you correctly, this would address something I've
> wanted list comprehensions to do for a little while:
>
> [x for x in range(0,10) until greaterthanN(4,x)]
Note that you can do something like
>>> def yet(b) :
if b : raise StopIteration
>>> list(x for x in range(0,10) if not yet(x>4))
[0, 1, 2, 3, 4]
Cheers, BB
More information about the Python-ideas
mailing list