Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve check for logical continuation in comprehension. #866

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented May 13, 2019

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 anntzer force-pushed the continuation-in-comprehension branch 3 times, most recently from d9582ae to f7b377a Compare March 1, 2020 18:17
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.
@anntzer anntzer force-pushed the continuation-in-comprehension branch from f7b377a to ace7b01 Compare March 1, 2020 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

E127: "continuation line over-indented" when comprehension is an argument
1 participant