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

Avoid removing whitespace for parenthesized walrus in subscripts #4078

Closed
MichaReiser opened this issue Nov 29, 2023 · 1 comment · Fixed by #4109
Closed

Avoid removing whitespace for parenthesized walrus in subscripts #4078

MichaReiser opened this issue Nov 29, 2023 · 1 comment · Fixed by #4109
Labels
C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. S: accepted The changes in this design / enhancement issue have been accepted and can be implemented T: bug Something isn't working

Comments

@MichaReiser
Copy link

MichaReiser commented Nov 29, 2023

Describe the bug

Related to the new walrus_subscript preview style and has previously been mentioned in this comment

Black removes whitespace around parenthesized walrus operators but preserves them for other binary operations:

x[(a + 4) :]
x[(a := 4):]

I would expect that the walrus operator gets formatted the same as any other binary operator:

x[(a := 4) :]

To Reproduce

See Playground

@MichaReiser MichaReiser added the T: bug Something isn't working label Nov 29, 2023
@JelleZijlstra JelleZijlstra added the C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. label Nov 29, 2023
@JelleZijlstra
Copy link
Collaborator

Agree we should change this.

@JelleZijlstra JelleZijlstra added the S: accepted The changes in this design / enhancement issue have been accepted and can be implemented label Nov 29, 2023
RedGuy12 added a commit to RedGuy12/black that referenced this issue Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: preview style Issues with the preview and unstable style. Add the name of the responsible feature in the title. S: accepted The changes in this design / enhancement issue have been accepted and can be implemented T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants