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

Indexing square brackets split on 3 lines #3068

Closed
ikamensh opened this issue May 11, 2022 · 2 comments
Closed

Indexing square brackets split on 3 lines #3068

ikamensh opened this issue May 11, 2022 · 2 comments
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

@ikamensh
Copy link

ikamensh commented May 11, 2022

Describe the style change
I have an assert statement that checks a condition on the last element in an array. To me what black does to the statement makes it less readable:

assert self.ref_transitions[-1].terminal.all(), "Last ref transition must be terminal."

Examples in the current Black style

assert self.ref_transitions[
    -1
].terminal.all(), "Last ref transition must be terminal."

Desired style

assert (
    self.ref_transitions[-1].terminal.all()
), "Last ref transition must be terminal."

# OR

assert self.ref_transitions[-1].terminal.all(), (
    "Last ref transition must be terminal."
)

Additional context

I think operation of taking [-1]th element is best visible with brackets and number grouped. Having to search them across a diagonal on 3 lines is tough.

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

felix-hilden commented May 11, 2022

Hi! The bracket break is tracked in #236, and assert formatting in #348. Therefore this could be considered a duplicate, if you think they satisfy your style proposal!

@ikamensh ikamensh changed the title Indexing square brackets and index split on 3 lines Indexing square brackets split on 3 lines May 11, 2022
@felix-hilden felix-hilden added the F: linebreak How should we split up lines? label Aug 15, 2022
@JelleZijlstra
Copy link
Collaborator

As @felix-hilden said this is a duplicate of various older issues.

@JelleZijlstra JelleZijlstra closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2022
@ichard26 ichard26 added the R: duplicate This issue or pull request already exists label Dec 20, 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

4 participants