[Python-Dev] PEP 8 misnaming

Ben Finney ben+python at benfinney.id.au
Wed Mar 14 14:03:10 CET 2012


Facundo Batista <facundobatista at gmail.com> writes:

>             if (width == 0 and height == 0 and
>                 color == 'red' and emphasis == 'strong' or
>                 highlight > 100):
>                 raise ValueError("sorry, you lose")
>
> In the example the line is broken after the 'and' or 'or' *keywords*,

‘and’ and ‘or’ are binary operators (that also happen to be keywords).
The description is accurate and IMO not misleading.

> not after the '==' *operator* (which is the nice way of doing it).

−1. The lower-priority binding operator is the better place to break the
line. The binary logical operators bind at lower priority than the
equality operator.

-- 
 \           “If you do not trust the source do not use this program.” |
  `\                                —Microsoft Vista security dialogue |
_o__)                                                                  |
Ben Finney



More information about the Python-Dev mailing list