Skip to content

Decide how to handle comments with debug expressions in f-strings #112243

Closed
@pablogsal

Description

@pablogsal

After PEP 701, having comments mixed with debug expressions is possible but the interactions has not been discussed. For instance, consider this code:

a = 1
f"{a = # my comment
}"

this produces:

'a = # my comment\n1'

which is surprising. What we should do here? I think we should probably not include the comment but we should agree on the behavior before a PR can be made

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions