[Python-Dev] PEP 498: Literal String Interpolation

Eric V. Smith eric at trueblade.com
Mon Aug 31 23:33:43 CEST 2015


On 8/31/2015 5:07 PM, Eric V. Smith wrote:
> That's all correct. I have to say that I like PEP 501 mainly for its
> non-string use cases. That is, interpolators that don't produce strings.
> Note that this isn't possible with PEP 502's proposal.

Let me rephrase that: with PEP 502, it must be possible to produce a
string from every e-string (as they're called there), and since
types.ExpressionString derives from str, it's even easier to misuse them
as strings and not provide the correct interpolator. This is as opposed
to PEP 501, where the equivalent type is not derived from str, and you
must call format() or a custom interpolator to get a str.

But back to PEP 498: I can't imagine accepting either PEP 501 or 502
without also accepting PEP 498. And once you've accepted 498, are i- or
e-strings sufficiently powerful and useful enough, and are they likely
to be used in the correct way? I think that's the question.

Eric.


More information about the Python-Dev mailing list