pycodestyle icon indicating copy to clipboard operation
pycodestyle copied to clipboard

Improve check for logical continuation in comprehension.

Open anntzer opened this issue 6 years ago • 0 comments

Excludes

sorted(obj for obj in iterator
       if some_long_cond()
          and some_other_cond())

from E127.

It is true that this also lets through some "bad" indents e.g.

(1 if a and 2 else
      b)

but at the tokenization level it is quite difficult to distinguish between the "if" in a for b in c if d and the "if" in a if b else c, which play quite different roles.

Closes #680.

anntzer avatar May 13 '19 06:05 anntzer