[Python-ideas] String interpolation for all literal strings

Barry Warsaw barry at python.org
Fri Aug 7 19:16:38 CEST 2015


On Aug 07, 2015, at 12:31 PM, Eric V. Smith wrote:

>I think it would, because you could say this, in some language where
>the order had to be reversed:
>"This interpolates {1} and {0}"

I think you'll find this rather error prone for translators to get right.
They generally need some semantic clues to help understand how to translate
the source string.  Numbered placeholders will be confusing.

>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.

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150807/c0944f16/attachment.sig>


More information about the Python-ideas mailing list