[Python-ideas] String interpolation for all literal strings

Eric V. Smith eric at trueblade.com
Fri Aug 7 21:15:22 CEST 2015


On 8/7/2015 12:33 PM, M.-A. Lemburg wrote:
> On 07.08.2015 18:16, Barry Warsaw wrote:
>> On Aug 07, 2015, at 07:50 PM, Nick Coghlan wrote:
>>
>>> Not quite. While I won't be entirely clear on Eric's latest proposal
>>> until the draft PEP is available, my understanding is that an f-string
>>> like:
>>>
>>>    f"This interpolates \{a} and \{b}"
> 
> I like the general idea (we had a similar discussion on this
> topic a few years ago, only using i"18n" strings as syntax), but
> I *really* don't like the "f" prefix on strings.
> 
> f-words usually refer to things you typically don't want in your
> code. f-strings are really no better, IMO, esp. when combined
> with the u prefix.

There would never be a reason to use "fu" as a prefix. "u" is only
needed for python 2.x compatibility, and this feature is only for 3.6+.

> Can the prefix character please be reconsidered before adding it
> to the language ?
> 
> Some other options:
> 
>  i"nternationalization" (or i"18n")
>  t"ranslate"
>  l"ocalization" (or l"10n")

Well, if we generalize this to something more than just literal string
formatting, maybe so. Until then, for the explicit version (as opposed
to the "all strings" version), I like "f". When I'm done with that PEP
we can start arguing about it.

Eric.



More information about the Python-ideas mailing list