Evaluation of variable as f-string
Chris Angelico
rosuav at gmail.com
Sat Jan 28 20:05:51 EST 2023
On Sun, 29 Jan 2023 at 11:53, Johannes Bauer <dfnsonfsduifb at gmx.de> wrote:
> I don't want to have to care about what quotation is used inside the
> string, as long as it could successfully evaluate using the f-string
> grammar.
>
Not possible. An f-string can contain other f-strings, and it is
entirely possible to use EVERY quote type. So you can never add quotes
around the outside of a string and then evaluate it as an f-string,
without making sure that it doesn't already contain that string.
(That MAY be changing in a future version of Python, but it's currently true.)
ChrisA
More information about the Python-list
mailing list