While this looks attractive to me, and it's definitely better to change statement and comprehension syntax at the same time, this makes the comprehension ambiguous to human parsing.
2013-07-02 00:44, Oscar Benjamin wrote:
[...]+1
Having a while clause on for loops is not just good because it saves a
couple of lines but because it clearly separates the flow control from
the body of the loop (another reason I dislike 'break if'). In other
words I find the flow of the loop
for p in primes() while p < 100:
print(p)
easier to understand (immediately) than
for p in primes():
if p >= 100:
break
print(p)
Cheers.
*j
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas