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

Line break added in list comprehension separates variable from its expression #4514

Open
funkybob opened this issue Nov 19, 2024 · 2 comments

Comments

@funkybob
Copy link

Black c47255

Playground link

Options

--line-length=88
--safe

Input

x = [
    t
    for t in y
    if t not in {
        LongNameOne,
        LongNameTwo,
        LongNameThree,
    }
]

Output

x = [
    t
    for t in y
    if t
    not in {
        LongNameOne,
        LongNameTwo,
        LongNameThree,
    }
]

Expected

x = [
    t
    for t in y
    if t not in {
        LongNameOne,
        LongNameTwo,
        LongNameThree,
    }
]

By moving the not in onto its own line it separates the variable from the expression it's a part of, breaking visual parsing.

@MrunaliniPachpute
Copy link

Hi @funkybob, can I work on this issue to address the concern with the not in operator?

@funkybob
Copy link
Author

Hi @MrunaliniPachpute ... I'm in no position to control who works on this issue, but I wholly welcome you trying!

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

No branches or pull requests

2 participants