[Python-ideas] Is this PEP-able? for X in ListY while conditionZ:
Stephen J. Turnbull
turnbull at sk.tsukuba.ac.jp
Tue Jun 25 20:12:24 CEST 2013
Shane Green writes:
> [x for x in l if x < 10 else break]?
That's currently invalid syntax: break is a statement. I think a
while clause (as suggested by David Mertz) would be a more plausible
extension of syntax.
I do think extending generator/comprehension syntax is much more
plausible than extending for loop syntax (for one thing, "just use
break" is not an answer here!)
More information about the Python-ideas
mailing list