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

Misleading formatting of long parenthesized yields of tuples #1553

Open
JelleZijlstra opened this issue Jul 16, 2020 · 0 comments
Open

Misleading formatting of long parenthesized yields of tuples #1553

JelleZijlstra opened this issue Jul 16, 2020 · 0 comments
Labels
S: accepted The changes in this design / enhancement issue have been accepted and can be implemented T: style What do we want Blackened code to look like?

Comments

@JelleZijlstra
Copy link
Collaborator

When code of the form (yield a, b) is split into multiple lines, Black puts the yield a and b each on its own line. This is misleading, because in fact this code yields the tuple (a, b), while Black's output makes it look like we yield only a.

Examples in the current Black style

def f():
    (
        yield abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_,
        abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_,
    )

Desired style

def f():
    yield (
        abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_,
        abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_abcdefg_,
    )

I encountered this in code using github.com/quora/asynq, which frequently contains statements of the form a, b = yield get_a.asynq(), get_b.asynq().

@JelleZijlstra JelleZijlstra added the T: style What do we want Blackened code to look like? label Jul 16, 2020
@ichard26 ichard26 added the S: accepted The changes in this design / enhancement issue have been accepted and can be implemented label May 30, 2021
@ichard26 ichard26 added this to the Release 22.0 milestone Dec 14, 2021
@ichard26 ichard26 removed this from the Release 22.0 milestone Jan 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: accepted The changes in this design / enhancement issue have been accepted and can be implemented T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

2 participants