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

Awkward line break in multiple component expression #3187

Closed
taldcroft opened this issue Jul 27, 2022 · 1 comment
Closed

Awkward line break in multiple component expression #3187

taldcroft opened this issue Jul 27, 2022 · 1 comment
Labels
F: linebreak How should we split up lines? R: duplicate This issue or pull request already exists T: style What do we want Blackened code to look like?

Comments

@taldcroft
Copy link

Describe the style change

Prefer formatting an expression with a line break before the operator instead of breaking for a getitem key. This seems to be a rare example where black is making the code far less readable.

Examples in the current Black style

            bad = (self.data[f"aoacfct{slot}"][i0:i1] != "TRAK") & self.data[
                "npnt_kalm"
            ][i0:i1]

Desired style

            bad = (
                (self.data[f"aoacfct{slot}"][i0:i1] != "TRAK")
                & self.data["npnt_kalm"][i0:i1]
            )

Additional context

Maybe this is a duplicate of #236, if so feel free to close.

@taldcroft taldcroft added the T: style What do we want Blackened code to look like? label Jul 27, 2022
@felix-hilden
Copy link
Collaborator

Thanks for the suggestion! It seems indeed to be a duplicate of the specified issue, and based on your desired formatting also #2156. So I'll close this one 👍

@felix-hilden felix-hilden added R: duplicate This issue or pull request already exists F: linebreak How should we split up lines? labels Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: linebreak How should we split up lines? R: duplicate This issue or pull request already exists T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

2 participants