[issue33754] f-strings should be part of the Grammar

Eric V. Smith report at bugs.python.org
Wed Oct 21 16:12:18 EDT 2020


Eric V. Smith <eric at trueblade.com> added the comment:

Just some notes to consider before work starts on this in earnest:

We need to decide what sort of changes we'll accept, if any. For at least the first round of this, I'm okay with "absolutely no change will be acceptable".

For example, here's a good change (IMO): allowing f'{"\n" if cond else ""}'. I'd like to be able to use backslashes inside strings that are in an expression.

A questionable change: f'{'foo'}'. Nesting the same type of quotes.

I think we should be explicit about what we will accept, because editors, etc. will need to adapt. In msg318550 I mention that some external tools use the same lexer they use for strings to lex f-strings. Are we okay with break that?

And the f-string '=' feature maybe be hard to support. Although if we are able to support it, then I think the same solution will be applicable to string annotations without unparsing them.

----------
nosy: +emilyemorehouse, pablogsal

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33754>
_______________________________________


More information about the Python-bugs-list mailing list