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

Inconsistent formatting of ** in tenary expression. #4149

Closed
randolf-scholz opened this issue Jan 11, 2024 · 2 comments · Fixed by #4154
Closed

Inconsistent formatting of ** in tenary expression. #4149

randolf-scholz opened this issue Jan 11, 2024 · 2 comments · Fixed by #4154
Labels
S: accepted The changes in this design / enhancement issue have been accepted and can be implemented T: bug Something isn't working

Comments

@randolf-scholz
Copy link

m2 = None if not isinstance(dist, Normal) else μ**2 + σ**2
m2 = None if ... else μ**2 + σ**2

becomes (black-playground)

m2 = None if not isinstance(dist, Normal) else μ ** 2 + σ**2
m2 = None if ... else μ**2 + σ**2

There are spaces added to μ**2 depending on unrelated code.

@randolf-scholz randolf-scholz added the T: bug Something isn't working label Jan 11, 2024
@JelleZijlstra
Copy link
Collaborator

Similar to #3889, which was fixed in preview mode. However, this issue is not fixed even in the preview mode. I thought we might mess up some length calculation due to the Greek letters, but that's not the case as it also reproduces with Latin letters:

% black -c  '''m2 = None if not isinstance(dist, Normal) else m**2 + s**2
m2 = None if ... else m**2 + s**2
''' --preview
m2 = None if not isinstance(dist, Normal) else m ** 2 + s**2
m2 = None if ... else m**2 + s**2

@JelleZijlstra JelleZijlstra added the S: accepted The changes in this design / enhancement issue have been accepted and can be implemented label Jan 11, 2024
@wannieman98
Copy link
Contributor

Hi @JelleZijlstra! Please review #4154, it is my proposed to fix the bug.

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: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants