[docs] [issue37813] PEP 7 line-breaking with binary operations contradicts Knuth's rule

Serhiy Storchaka report at bugs.python.org
Tue Aug 13 13:27:48 EDT 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

PEP 8 contains contradictory examples.

https://www.python.org/dev/peps/pep-0008/#indentation

>     # No extra indentation.
>     if (this_is_one_thing and
>         that_is_another_thing):
>         do_something()
> 
>     # Add a comment, which will provide some distinction in editors
>     # supporting syntax highlighting.
>     if (this_is_one_thing and
>         that_is_another_thing):
>         # Since both conditions are true, we can frobnicate.
>         do_something()
> 
>     # Add some extra indentation on the conditional continuation line.
>     if (this_is_one_thing
>             and that_is_another_thing):
>         do_something()
> 
> (Also see the discussion of whether to break before or after binary
> operators below.)

(It was already reported in other issue.)

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37813>
_______________________________________


More information about the docs mailing list