[Python-ideas] Is this PEP-able? for X in ListY while conditionZ:
Jan Kaliszewski
zuo at chopin.edu.pl
Tue Jul 2 04:03:50 CEST 2013
2013-07-02 00:44, Oscar Benjamin wrote:
[...]
> 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)
+1
Cheers.
*j
More information about the Python-ideas
mailing list