[Python-ideas] Let’s make escaping in f-literals impossible

C Anthony Risinger anthony at xtfx.me
Fri Aug 19 16:50:10 EDT 2016


On Fri, Aug 19, 2016 at 3:39 PM, David Mertz <mertz at gnosis.cx> wrote:

> I don't think I've ever used a syntax highlighter than changed color of \n
> in a string. I get the concept, but I haven't suffered for the absence of
> that.
>
> Moreover, although I haven't yet used them, I really doubt I want extra
> syntax highlighting in f-strings beyond simply the color strings appear as.
> Well, maybe a uniform distinction for f-string vs. some other kind of
> string, but nothing internal to the string.
>
> YMMV, but that would be my preference in my text editor. Curly braces are
> perfectly good visual distinction to me.
>
At least vim does this and so does Sublime Text IIRC. Maybe I spend a lot
of time writing shell code too, but I very much appreciate the extra visual
cue.

The only real point I'm trying to make is that expressions within an
f-string are an *escape*. They escape the normal semantics of a string
literal and instead do something else for a while. Therefore, the escaped
sections should not look like (or need to conform to) the rest of the
string and they should not require quoting as if it were still within the
string, because I escaped it already!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160819/38aa5f93/attachment.html>


More information about the Python-ideas mailing list