[Python-ideas] PEP8 operator must come before line break
barry at python.org
Thu Apr 14 16:34:36 EDT 2016
On Apr 14, 2016, at 05:25 PM, SW wrote:
>PEP8 says that: "The preferred place to break around a binary operator
>is after the operator, not before it."
Personally, my own preferred style prefers keyword binary operators,
e.g. 'and' and 'or', after the line break but operator symbols (e.g. '*' or
'+') before the line break. The way my editor syntax highlights the keywords
but not the operators makes this style the most readable to me.
However, I think the pep8 tool is too strict here. PEP 8 the document doesn't
say the line break around binary operators is *required* just that it's a
preferred style. Forcing the line break here seems like the tool is
overstepping and I would favor a relaxation of the tool. Where I've adopted
flake8 and such, I've grumbled when it forces me to make this change. (But I
guess not enough to file a bug. ;)
If the pep8 developers insist on reading PEP 8's "preferred" as a strict
requirement, then I would favor clarification in PEP 8 that such line breaks
are not required and that either choice of line break positioning around
binary operators is acceptable.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 819 bytes
Desc: OpenPGP digital signature
More information about the Python-ideas