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

single element tuples in yield expressions are not parenthesized #3851

Open
konstin opened this issue Aug 22, 2023 · 0 comments · May be fixed by #3912
Open

single element tuples in yield expressions are not parenthesized #3851

konstin opened this issue Aug 22, 2023 · 0 comments · May be fixed by #3912
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

@konstin
Copy link
Contributor

konstin commented Aug 22, 2023

Describe the style change

Unlike other expression level single element tuples, single element tuples in yield expressions (e.g. yield 1,) are currently not parenthesized. This is inconsistent, they should also be parenthesized.

Examples in the current Black style

Input:

for a, in b:
    pass

c = d,


def e():
    yield f,
    return g,

Output:

for (a,) in b:
    pass

c = (d,)


def e():
    yield f,
    return (g,)

Desired style

for (a,) in b:
    pass

c = (d,)


def e():
    yield (f,) 
    return (g,)

Additional context

black 23.7.0

@konstin konstin added the T: style What do we want Blackened code to look like? label Aug 22, 2023
@hauntsaninja hauntsaninja added the S: accepted The changes in this design / enhancement issue have been accepted and can be implemented label Aug 22, 2023
spagh-eddie added a commit to spagh-eddie/black that referenced this issue Oct 2, 2023
@spagh-eddie spagh-eddie linked a pull request Oct 2, 2023 that will close this issue
3 tasks
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

Successfully merging a pull request may close this issue.

2 participants