Skip to content

Formatter: Trailing comment on list gets formatted to a separate line #6367

@dhruvmanila

Description

@dhruvmanila

Given:

[  # comment
    first,
    second,
    third
]  # another comment

Notice that there's no magic trailing comma, so the list will be collapsed.

Ruff:

[first, second, third]  # comment
  # another comment

Black:

[first, second, third]  # comment  # another comment

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