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

David Halter report at bugs.python.org
Sun Jun 3 10:22:54 EDT 2018


David Halter <davidhalter88 at gmail.com> added the comment:

As I wrote before, I'm not trying to change anything about the f-string behavior. It is a refactoring. If anyone wants to change the behavior, I feel like they should probably write a PEP anyway.

I personally don't like that f-strings get parsed multiple times. It just smells bad. Also f-strings are IMO not just strings. They should maybe look like strings for other tools to parse them. But they are more or less statements that get executed.

The code in ast.c is not bad. Don't get me wrong. I just think that it's the wrong approach.

Regarding the edge cases: I don't think there are that many. In the end the ast output will look similar anyway. All the backslashes, string literals and comments can be checked and rejected in the tokenizer already.

----------

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


More information about the Python-bugs-list mailing list