black
black copied to clipboard
Inconsistent formatting of `**` in tenary expression.
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.
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
Hi @JelleZijlstra! Please review #4154, it is my proposed to fix the bug.