Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
pablogsal opened this issue Nov 18, 2023 · 2 comments
Open

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

pablogsal opened this issue Nov 18, 2023 · 2 comments

Comments

@pablogsal
Copy link
Member

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

@pablogsal
Copy link
Member Author

@isidentical @lysnikolaou

@ericvsmith
Copy link
Member

I think we should remove the comment and keep the newline.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants