Eric V. Smith added the comment:
The reason that this was done was to give us flexibility in deciding how the
backslashes should be interpreted in the future. I announced it on python-dev
here: https://mail.python.org/pipermail/python-dev/2016-August/145979.html.
That message contains a link to the python-ideas discussion that precipitated
the change.
PEP 536 is one proposal to change how this is handled. I don't entirely agree
with it, since I think allowing:
f'Magic wand: { bag['wand'] }'
would be confusing and make life more difficult for simple (regex based)
parsers to skip over f-strings.
Notice that in Jupiter
(https://github.com/jupyter/notebook/issues/2037#issuecomment-272466046) and in
CodeMirror
(https://github.com/codemirror/CodeMirror/commit/c45674b11e990fe37abc662b0c507d3bb1f635e7#diff-04f7f1f1bbbab888742c7e849187a79c)
they were able to make simple changes to their parsers and "support" f-strings
(for some value of "support": mostly not break in the presence of f-strings).
However, I'm not completely opposed to revisiting the issue. Your use case is
certainly a compelling one.
----------
assignee: -> eric.smith
nosy: +eric.smith
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30793>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com