[Python-ideas] String interpolation for all literal strings

Tim Delaney timothy.c.delaney at gmail.com
Thu Aug 6 23:03:01 CEST 2015


On 6 August 2015 at 16:05, Nathaniel Smith <njs at pobox.com> wrote:

> On Wed, Aug 5, 2015 at 9:35 PM, Nick Coghlan <ncoghlan at gmail.com> wrote:
> > use "!" as the prefix instead of "f" to more clearly emphasise the
> > distinction from the subtle effects of "u", "b" and "r"
>
> Hey, maybe $ would make an even better string-interpolation sigil anyway?
>

+1 for $"..." being an interpolated string. The syntax just makes sense.
Doesn't prevent us from using $ elsewhere, but it does set a precedent that
it should be used in interpolation/substitution-style contexts.

+0 for !"..." being an interpolated string. It's not particularly obvious
to me, but I do like the def foo!(ast) syntax, and symmetry with that
wouldn't be bad. Although I wouldn't mind def foo$(ast) either - $ stands
out more, and this could be considered a substitution-style context.

-1000 on unprefixed string literals becoming interpolated. But the prefix
should be able to be used with raw strings somehow ... r$"..."? $r"..."?

Tim Delaney
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150807/45dcf2e9/attachment.html>


More information about the Python-ideas mailing list