[Python-ideas] Let’s make escaping in f-literals impossible
Philipp A.
flying-sheep at web.de
Tue Aug 30 08:56:45 EDT 2016
Eric V. Smith <eric at trueblade.com> schrieb am Di., 30. Aug. 2016 um
14:13 Uhr:
> There's debate on if that's the right way, and I personally think it's
> probably not. Personally, I'd be happy with the only change being to not
> allow backslashes inside braces. But that's not an argument that I'm
> willing to get into now, since I need to get this rolling for beta 1.
And exactly that’s why i’m very happy with the way things are going:
Banning escapes is the right short term solution, and possibly the best
compromise if we can’t find consensus on how escapes should behave inside
of those braces.
אלעזר <elazarg at gmail.com> schrieb am Di., 30. Aug. 2016 um 14:37 Uhr:
> The problem is that "literal" is a technical term in the domain of
> compilers, and not a well known or self-explanatory term. Especially for
> beginners. I'd suggest something like "Format expression".
>
That sounds fine as well!
My issue is just that it’s as much of a string as a call of a (string
returning) function/method or an expression concatenating strings:
''.join(things) # would you call this a string?
'{!r}'.format(x) # or this? it’s basically the same as this “f-string”:
f'{x!r}'
'start' + 'end' # or this? it’s a concatenation of two strings, just like
f'start{ "end" }'
Best, Philipp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160830/6dec4e5a/attachment.html>
More information about the Python-ideas
mailing list