[Python-ideas] Draft PEP on string interpolation

Mike Miller python-ideas at mgmiller.net
Sat Aug 22 02:01:49 CEST 2015



On 08/21/2015 04:33 PM, MRAB wrote:
> f-strings use {} syntax, so I'd prefer t-string to use {} syntax too,
> unless you're happy to explain it to all those users who'll be asking
> why f-strings use {} but t-strings use $. (I might even be one of them!
> :-))

Hi, the reason is above, it fits the use case perfectly.  Most devs (that know 
nothing about i18n) will not know it exists.

However, imagine the opposite situation...

We'll have to explain to non-technical translators how to use a new syntax,
which they'll sometimes make mistakes with.

We'll have to explain and lecture devs and translators frequently not to use 
format specifiers and arbitrary expressions, etc.

We'll have to document policy and write tools to make sure advanced features 
don't get used in translating.  The checks may not be done at compile time, so 
those who don't use linters won't be helped.

All to avoid $,${} in favor of {}.

Certainly either strategy could be done, but one is easier, doesn't put i18n 
needs at a disadvantage, and won't affect the typical developer.

I agree neither choice is perfect.

-Mike


More information about the Python-ideas mailing list