Skip to content

Allow no space between operator ** #538

@paugier

Description

@paugier

This is a follow up of issue #148 (see in particular #148 (comment) by @njsmith)

Black still adds spaces around the operator **.

It is really bad for readability of math formula and it is not consistent with PEP 8 (https://www.python.org/dev/peps/pep-0008/#other-recommendations).

This operator has a so high precedence (https://docs.python.org/3/reference/expressions.html#operator-precedence) so I think it should be allowed not to put spaces around it.

I know that we can use

# fmt: off
t = a**2 + b**3
# fmt: on

for math, but many times, the spaces around ** are the worst problems, so allowing a**2 would save us from adding too many # fmt: off ... # fmt: on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T: enhancementNew feature or requestT: styleWhat do we want Blackened code to look like?help wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions