[Python-ideas] Draft PEP on string interpolation

Nikolaus Rath Nikolaus at rath.org
Tue Aug 25 04:05:36 CEST 2015


On Aug 24 2015, Mike Miller <python-ideas-9N9vo3BbZlHk1uMJSBkQmQ at public.gmane.org> wrote:
> On 08/24/2015 02:28 PM, Nikolaus Rath wrote:
>> *shudder*. After years of efforts to get people not to do this, you want
>> to change course by 180 degrees and start telling people this is ok if
>> they add an additional single character in front of the string?
>>
>> This sounds like very bad idea to me for many reasons:
>>
>>   - People will forget to type the 'e', and things will appear to work
>>     but buggy.
>>   - People will forget that they need the 'e' (and the same thing will
>>     happen, further reinforcing the thought that the e is not required)
>>   - People will be confused because other languages don't have the 'e'
>>     (hmm. how do I do this in Perl? I guess I'll just drop the
>>     'e'... *check*, works, great!)
>>   - People will assume that their my_custom_system() call also
>>     special-cases e strings and escape them (which it won't).
>>
>
> No, since the variables will not be replaced, therefore the
> command-line won't work.

How is that compatible with your statement that

> This means a billion lines of code using e-strings won't have to care
> about them, only a handful of places.

Either str(estr) performs interpolation (so billions of lines of code
don't have to change, and my custom system()-like call get's an
interpolated string as well until I change it to be estr-aware), or it
does not (and billions of lines of code will break when they
unexpectedly get an estr instead of a str).

Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«


More information about the Python-ideas mailing list