[Python-ideas] if-statement in for-loop

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 27 17:36:22 EDT 2016


Erik Bray wrote:
> Then following my own logic it
> would be desirable to also allow the nested for loop syntax of list
> comprehensions outside them as well.

The only use for such a syntax would be to put
an inadvisable amount of stuff on one line.

When describing a procedural series of steps,
the Pythonic style encourages putting each step
on its own line. Other areas of the language also
nudge one in this direction, e.g. the fact that
mutating operations usually return None, which
discourages chaining them together into a single
expression.

-- 
Greg



More information about the Python-ideas mailing list