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

Tiny slice gets pushed onto new lines #1280

Open
TomFryers opened this issue Feb 20, 2020 · 1 comment
Open

Tiny slice gets pushed onto new lines #1280

TomFryers opened this issue Feb 20, 2020 · 1 comment
Labels
F: linebreak How should we split up lines? T: style What do we want Blackened code to look like?

Comments

@TomFryers
Copy link
Contributor

TomFryers commented Feb 20, 2020

Describe the style change For a tiny two-character slice, putting it on an extra line is often unnecessary.

Examples in the current Black style

def f():
     columnaligns = remove_columns([newheadsalign + ["text-align:center"]], removes)[0][
         1:
    ]

Desired style

def f():
     columnaligns = remove_columns([newheadsalign + ["text-align:center"]], removes)[0][1:]
@TomFryers TomFryers added the T: style What do we want Blackened code to look like? label Feb 20, 2020
@intgr
Copy link

intgr commented Feb 26, 2020

If it exceeds the line length limit, I think Black should split it. However, it would be far better to split the longest expression, for example:

def f():
    columnaligns = remove_columns(
        [newheadsalign + ["text-align:center"]], removes
    )[0][1:]

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? T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

3 participants