[Python-Dev] PEP 8 updated on whether to break before or after a binary update

Gustavo Carneiro gjcarneiro at gmail.com
Fri Apr 15 13:15:09 EDT 2016


On 15 April 2016 at 18:03, Victor Stinner <victor.stinner at gmail.com> wrote:

> Hum.
>
>         if (width == 0
>             and height == 0
>             and color == 'red'
>             and emphasis == 'strong'
>             or highlight > 100):
>             raise ValueError("sorry, you lose")
>
> Please remove one space to vertically align "and" operators with the
> opening parenthesis:
>
>         if (width == 0
>            and height == 0
>            and color == 'red'
>            and emphasis == 'strong'
>            or highlight > 100):
>             raise ValueError("sorry, you lose")
>

Personally, I think what you propose looks ugly.  The first version looks
so much better.


It helps to visually see that the multiline test and the raise
> instruction are in two different blocks.


The only thing I would add would be an empty line to help distinguish the
if expression block from the "then" code block:

        if (width == 0
            and height == 0
            and color == 'red'
            and emphasis == 'strong'
            or highlight > 100):

            raise ValueError("sorry, you lose")


-- 
Gustavo J. A. M. Carneiro
Gambit Research
"The universe is always one step beyond logic." -- Frank Herbert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20160415/b63de748/attachment.html>


More information about the Python-Dev mailing list