[Python-Dev] PEP 498: Literal String Interpolation

Yury Selivanov yselivanov.ml at gmail.com
Mon Aug 31 22:08:57 CEST 2015



On 2015-08-31 9:10 AM, Nick Coghlan wrote:
> On 30 August 2015 at 23:41, Eric V. Smith <eric at trueblade.com> wrote:
>> Note there's a companion PEP 501 which extends this idea by delaying
>> converting the expression into a string. This allows for more control
>> over how the expressions are converted in to strings, and allows for
>> non-string conversions as well.
> For the benefit of folks that weren't following the (many) iterations
> on python-ideas: PEP 501's general purpose string interpolation
> started out as a competitor to 498, but as the discussion continued
> and my ideas started to converge more and more with Eric's, I
> eventually realised it made more sense as an optional extension to PEP
> 498 that exposed the inner workings of the scope aware interpolation
> machinery to Python code.

If PEP 501 is an extension to PEP 498, then the proposal
is to add i'' prefix *in addition* to f'', right?

If so, I think it might be confusing to a lot of people on
what prefix should be used and when.  I think it's too easy
for an average user to write ``os.system(f'...')`` and think
that their code is fine, instead of ``os.system(i'...')``.
What's worse, is that there is no way for ``os.system()``
to reject the former use.

Second, given that we use "f" for "formatted", using "i"
for "interpolated template" is a bit confusing.  Can
we use "t" ("template strings")?

Yury


More information about the Python-Dev mailing list