[Python-ideas] String interpolation for all literal strings

Yury Selivanov yselivanov.ml at gmail.com
Fri Aug 7 21:17:42 CEST 2015


On 2015-08-07 1:08 PM, Barry Warsaw wrote:
> * Arbitrary expressions
>
> These just add complexity.  Remember than translators have to copy the
> placeholder verbatim into the translated string, so any additional noise will
> lead to broken translations, or worse, broken expressions (possibly also
> leading to security vulnerabilities or privacy leaks!).  I personally think
> arbitrary expressions are overkill and unnecessary for interpolation, but if
> they're adopted in the final PEP, I would just urge i18n'ers to avoid them at
> all costs.

Yes.  And overall I think that

     sum = a + b
     print(f'the sum is {sum}')

is more pythonic (readability, explicitness etc) than this:

     print(f'the sum is {a + b}')

And that's just a trivial example.

Yury


More information about the Python-ideas mailing list