Skip to content

Nested expression formatting #12856

@MichaReiser

Description

@MichaReiser

I was surprised that there's no existing issue for this.

We decided not to implement the following Black 24 style changes:

  • parenthesize_long_type_hints,
  • wrap_long_dict_values_in_parens
  • parenthesize_conditional_expressions

Because a) implementing this in Ruff is kind of hard (or slow) and b) it goes against the overall goal to avoid unnecessary parentheses.

This Black issue goes into more detail about our concerns. We should explore different designs that yields better sub-expression formatting without requiring optional parentheses to improve readability.

Metadata

Metadata

Assignees

No one assigned

    Labels

    formatterRelated to the formatter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions