Pycodestyle: Should this line trigger some sort of linting error?

Created on 15 Mar 2017  路  8Comments  路  Source: PyCQA/pycodestyle

I had a hard time finding something in pep8 that would forbid this (and pycodestyle itself doesn't trigger a lint) but deep down inside I feel it surely should :)

[(a,)for a in y]

Maybe something like "expected spaces around keyword for"?

Most helpful comment

Would the rule here be 'all keywords must be preceded and followed by one space character'?

All 8 comments

but deep down inside I feel it surely should

I feel the same.

This should probably be a new check altogether though.

This is a grey area as I noted in a similar case https://github.com/PyCQA/pycodestyle/issues/570

But [pep 8] doesnt address when unassigned data-structures are used immediately near a keyword like if or for.

I suspect this should be a non-controversial update to PEP 8.

Another (related) strange one:

from .import bar

(works the same as from . import bar)

Is that supposed to be from .import bar?

yep, woops, edited

Would the rule here be 'all keywords must be preceded and followed by one space character'?

Another related case:

try:
    ...
except(IOError,):
    ...

Duplicate of #371

Was this page helpful?
0 / 5 - 0 ratings