Skip to content

Conversation

@tom-pytel
Copy link
Contributor

@tom-pytel tom-pytel commented Nov 8, 2025

Fix more complex cases of f/t-string quotes and nested f/t-strings. This is initial quick job so there is chance I missed something so please have a good look.

Question remaining, should the comments of NESTED f/t-strings show up in the parent f/t-string expression or not. In other words, should the following:

>>> print(f'{ # comment A
... (f'''
... # not comment B
... { # comment C '
... 3 # comment D
... * 2}''', '\n# not comment E\n6')=}')

Evaluate to:

(f'''
# not comment B
{ 
3 
* 2}''', '\n# not comment E\n6')=('\n# not comment B\n6', '\n# not comment E\n6')

Or (parent # comment A stripped, nested comments left):

(f'''
# not comment B
{ # comment C '
3 # comment D
* 2}''', '\n# not comment E\n6')=('\n# not comment B\n6', '\n# not comment E\n6')

Currently is first case, all stripped.

@tom-pytel
Copy link
Contributor Author

Ping @pablogsal, @lysnikolaou

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant