
I know I'm strongly -1 on allowing much more than currently exists for f-strings. For basically the same reason Stephen explains. Newlines inside braces, for example, go way too far away from readability. Nested expressions also feel like an attractive nuisance. I use f-strings all the time, but in much the same way a thousand character regular expression is an abuse (even if perfectly well defined grammatically), really complex f-strings worries look and feel much the same. On Mon, Sep 20, 2021, 9:39 PM Stephen J. Turnbull < stephenjturnbull@gmail.com> wrote:
Eric V. Smith writes:
But this does not:
f'{1 + 2}'
The later is an error with or without the 'f' prefix and I think that this should continue to be the case.
The thought is that anything that's within braces {} and is a valid expression should be allowed.
-0 FWIW, some thoughts specific to me, I don't know how representative they might be of others.
I guess you could argue that the braces are a kind of expression-level parenthesis, but I don't "see" them that way. I see *one* string with eval'able format expressions embedded in it, so that single-quoted strings can't have embedded newlines. I also don't see the braces as expression-level syntax (after all, they already have two different meanings at expression level), I see them as part of f-string syntax. So even with triple-quoted strings, my eyes "want" to see parentheses or line continuation (which already work).
I'm sure I could get used to the syntax. But ...
Is this syntax useful? Or is it just a variant of purity trying to escape Pandora's virtualbox? I mean, am I going to see it often enough to get used to it? Or am I going to WTF at it for the rest of my life? _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/RPFHA55J... Code of Conduct: http://python.org/psf/codeofconduct/