[Python-ideas] String interpolation for all literal strings

Nick Coghlan ncoghlan at gmail.com
Sat Aug 8 02:49:44 CEST 2015


On 8 Aug 2015 03:17, "Barry Warsaw" <barry at python.org> wrote:
>
> On Aug 07, 2015, at 12:31 PM, Eric V. Smith wrote:
>
> >Now I'll grant you that it reduces usability. But it does provide the
> >needed functionality.
> >
> >But I can't see how we'd automatically generate useful names from
> >expressions, as opposed to just numbering the fields. That is, unless
> >we go back from general expressions to just identifiers. Or, use
> >something like Nick's suggestion of also passing in the text of the
> >expressions, so we could map identifier-only expressions to their
> >indexes so we could build up yet another string.
>
> Right.  Again, *if* we're trying to marry i18n and interpolation, I would
> greatly prefer to ditch general expressions and just use identifiers.

I think we're all losing track of what's being proposed and what we'd like
to make easy (I know I am), so I'm going to sit on my hands in relation to
this discussion until Eric has had a chance to draft his PEP (I leave for a
business trip to the US tomorrow, so I may actually stick to that kind of
commitment for once!).

Once Eric's draft is done, we can create a competing PEP that centres the
il8n use case by building on the syntax in Ka-Ping Yee's original PEP 215
(which also inspired the string.Template syntax in PEP 292) but using the
enhanced syntactic interpolation machinery from Eric's proposal.

(MAL's suggestion of "i-strings" as the prefix is also interesting to me,
as that would work with either "interpolated string" or "il8n string" as
the mnemonic)

Regards,
Nick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150808/5e5348c1/attachment.html>


More information about the Python-ideas mailing list