Skip to content

Comment placement of expressions with keywords #5780

@MichaReiser

Description

@MichaReiser

We have a few nodes that are separated by a keyword. For example:

with (x as y) # x and y are separated by the as keyword
except x as e: # Same
call(a, b) # a and b are separated by a comma
...

It would be nice if we could unify the comment placement logic for all of these.

i wonder if an abstraction with two nodes with a single token in between makes sense, which would also force us to handle them consistently. We have the same pattern in slices (x[a:b]), argument lists x(a,b) and binary expressions (a+b). (also this feature is inconsistent because with (a as b) works but except (a as b) doesn't).
Original Message from @konstin

This task aims to explore if generalizing the logic is possible and, if so, implement the generalization.

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