Skip to content

Formatter fails to parenthesize walrus expressions in function return types #6437

Closed
@charliermarsh

Description

@charliermarsh

I saw this example in Black:

def this_is_so_dumb() -> (please := no): ...

def this_is_so_dumb(x) -> (please := no): ...

Right now, the formatter strips parentheses on the right-hand side, seemingly because optional_parentheses doesn't take required parentheses into account, unlike maybe_parenthesize_expression.

Metadata

Metadata

Assignees

Labels

formatterRelated to the formatter

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions