Pycodestyle: Completely remove W503 and W504

Created on 7 Sep 2018  路  4Comments  路  Source: PyCQA/pycodestyle

For multiple warnings it is said in the docs "they are not rules unanimously accepted, and PEP 8 does not enforce them". But in the case of W503 and W504, it is more than that: pep8 says that new code should use the other convention:
"In Python code, it is permissible to break before or after a binary operator, as long as the convention is consistent locally. For new code Knuth's style is suggested."

I know that these warnings are not supposed to be activated by default, but they are on some editor plugins using pycodestyle (like the great Sublime Text plugin Anaconda).

I suggest that these two warnings be completely removed.

Most helpful comment

It's a bug that those tools enable both by default. The rules exist there so someone may use one or the other to enforce the chosen convention locally.

All 4 comments

It's a bug that those tools enable both by default. The rules exist there so someone may use one or the other to enforce the chosen convention locally.

I find at least the W504 extreamly confusing as it doesn't even tell me how to rewrap the code to make it pass.... so I am not surprised people want to eradicate it.

A rule like should exist only if it able to tell you what to fix it. For the moment I am still trying to find some examples...

I find at least the W504 extreamly confusing as it doesn't even tell me how to rewrap the code to make it pass.... so I am not surprised people want to eradicate it.

W503 doesn't tell you either. I'm not sure what this has to do with anything. Compare

https://github.com/PyCQA/pycodestyle/blob/c3d2cbd744236c3a41d1013c9dce2712dcc4eee0/pycodestyle.py#L1251

https://github.com/PyCQA/pycodestyle/blob/c3d2cbd744236c3a41d1013c9dce2712dcc4eee0/pycodestyle.py#L1285

A rule like should exist only if it able to tell you what to fix it. For the moment I am still trying to find some examples...

PEP-0008 is the source of the examples you want.

For new code Knuth's style is suggested

__flake8 --ignore=W503 --select=W504 new_code.py__

Was this page helpful?
0 / 5 - 0 ratings