On 9/21/2021 7:42 PM, Eric V. Smith wrote:
I don't recall exactly why, but I disallowed backslashes inside
expressions at the last minute before 3.6 was released. It might have
been because I was interpreting them in a way that didn't make sense if
a "real" parser were inspecting f-strings. The idea, even back then, was
to re-allow them when/if we moved f-string parsing into the parser
itself. I think it's time.
Yeah, we were still trying to figure out whether escapes like "\\n"
would be evaluated as "\\n" or "\n" in the expression, and decided to
decide later. If we can clearly articulate which it is now, then let's
go ahead and enable it.
* The parser will allow nesting quote characters. This means that we
**could** allow reusing the same quote type in nested expressions
like this:
f"some text { my_dict["string1"] } more text"
I'm okay with this, with the caveat that I raised in another email: the
effect on non-Python tools and alternate Python implementations.
As a fairly regular user, I would be very happy to not have to worry
about mixing quotes. It's also not going to break any existing code, so
safe enough to enable if we can.
Agreed with Eric on the rest.
Cheers,
Steve
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@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/ZQDQRUI4JZOQT7IW2MU2IGJCGHWZH7Q4/
Code of Conduct: http://python.org/psf/codeofconduct/