[Python-ideas] allow line break at operators

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Aug 11 22:32:41 EDT 2011


Matt Joiner wrote:

> +0.5
> 
> The "trailing \" workaround is nonobvious. Wrapping in () is noisy and
> already heavily used by other syntactical structures.

"Noisy"? Compare:


# Best viewed with a fixed-width font
if a                      if (a
   and b                      and b
   or c:                      or c):
   do stuff()                 do stuff()  


That is not my idea of "noise". The brackets have a clear and obvious
meaning: they group the condition.


> Since a final
> ':' is needed anyway, i think this would be great.

A final : is not needed for arbitrary expressions.

flag = (a
        and b
        or c)


-- 
Steven




More information about the Python-list mailing list