[Python-ideas] if in for-loop statement

Sven R. Kunze srkunze at mail.de
Fri Feb 24 04:58:15 EST 2017

On 24.02.2017 05:45, Chris Angelico wrote:
> Don't forget that you can rewrite a "for-if" using two additional
> lines and no indents, rather than one line and one indent:
> for ...:
>      if not (...):
>          continue
>      ...
>      ...

That's exactly what I meant by "for+if+continue". At work we even set a 
guideline for this to prevent excessive indentation for longer loop bodies.

> So you can take your pick which version you want. Granted, I can still
> see value in the for-if statement, but not enough to justify new
> syntax.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170224/c7962267/attachment.html>

More information about the Python-ideas mailing list