[Python-ideas] Draft PEP on string interpolation

Mike Miller python-ideas at mgmiller.net
Mon Aug 24 23:54:40 CEST 2015


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.

The previous proposals ignored this altogether.  A partial solution is better 
than none, I think.  I don't propose we document this as the recommended way, 
anyway.  subprocess.call('foo', shell=False) is that.

This is just a way to do the right thing in a number of common situations where 
we can do it.

-Mike


More information about the Python-ideas mailing list