Skip to content

F-string formatting adds unnecessary space after ** operator #14487

@dhruvmanila

Description

@dhruvmanila

Consider the following source code:

f"aaaaaaaaaaaaaaaaaaaaaaaaaa {10**27} bbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc"

Running ruff format --preview:

f"aaaaaaaaaaaaaaaaaaaaaaaaaa {10** 27} bbbbbbbbbbbbbbbbbbbbbbbbbb ccccccccccccccccccccccccc"

Playground: https://play.ruff.rs/80926d6e-f183-4631-94ce-f1702502a0e0

Found in #14454 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingformatterRelated to the formatterpreviewRelated to preview mode features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions