[issue36798] f-strings do not support top-level :=

Stefan Behnel report at bugs.python.org
Sun May 5 13:56:28 EDT 2019


Stefan Behnel <stefan_ml at behnel.de> added the comment:

FWIW, I think it's equally reasonable to allow assignment expressions directly in f-strings, as it is to require parentheses with a reference to the invalidity of top-level expressions.

That makes me lean towards adding a parse-time error message that suggests the right way to do it, and leave it out as a feature for now, because it risks conflicting with ":" as format separator. We do not know yet if we will really need this feature. It's easier to add the feature later, than to remove it again in case we find that it gets in the way more than it helps.

----------
nosy: +scoder

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


More information about the Python-bugs-list mailing list