Skip to content

Unintentional formatter deviation: spaces added around power operator (**) #8187

@stinodego

Description

@stinodego

The power operator is usually used without surrounding spaces to indicate precendence over other operators. The following code is left alone by both black and ruff:

x = 2**2

However, when the right operand is None, ruff adds spaces, while black leaves it. In this case, I think black is correct.

- x = 2**None
+ x = 2 ** None

This change is undesirable. Note that this code does not run (TypeError) - but we have something similar in our test suite where we test the __pow__/__rpow__ implementation on some of our types.

Command: ruff format .
Formatter settings: None
Version: ruff 0.1.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingformatterRelated to the formatter

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions