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 the style of breaking long lines into two #4203

Open
marcinwazny opened this issue Feb 1, 2024 · 0 comments
Open

Improve the style of breaking long lines into two #4203

marcinwazny opened this issue Feb 1, 2024 · 0 comments
Labels
T: style What do we want Blackened code to look like?

Comments

@marcinwazny
Copy link

Describe the style change

Black treats long lines that can be broken into two differently from those that can be broken into three or more. It seems to me that, unfortunately, in the first case it does it quite poorly.

Examples in the current Black style

match "some very long string to match".split():
    case ["string", "some", "very", "long", "to", "match"] | [
        "very",
        "some",
        "long",
        "string",
        "to",
        "match",
    ]:
        pass

Desired style

match "some very long string to match".split():
    case (
        ["string", "some", "very", "long", "to", "match"]
        | ["very", "some", "long", "string", "to", "match"]
    ):
        pass

Additional context

This is how black currently formats long lines, which can be broken into three or more.

match "some very long string to match".split():
    case (
        ["string", "some", "very", "long", "to", "match"]
        | ["very", "some", "long", "string", "to", "match"]
        | ["some", "very", " long", "string", "to", "match"]
    ):
        pass
@marcinwazny marcinwazny added the T: style What do we want Blackened code to look like? label Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

1 participant