[Python-ideas] Draft PEP on string interpolation
Nikolaus Rath
Nikolaus at rath.org
Tue Aug 25 20:40:19 CEST 2015
On Aug 25 2015, Mike Miller <python-ideas-9N9vo3BbZlHk1uMJSBkQmQ at public.gmane.org> wrote:
> On 08/25/2015 08:02 AM, Nikolaus Rath wrote:
>> No, but it muddles the water as to what is good and what is bad
>> practice. 'rm {file}' has always been bad practice, but with e-strings
>> e'rm {file}' may or may not be bad practice, depending what you do with
>> it.
>
> It would be bad practice since the function is deprecated, or just
> discouraged.
What function?
> But, are you implying that the escaping could be bypassed? Would that
> be possible?
According to you, yes. Just look at your example:
| def os_system(command): # imagine os.system, subprocess, dbapi, etc.
| if isinstance(command, estr):
| command = command.escape(shlex.quote) # each chooses its own rules
| do_something(command)
So any function that doesn't special-case estr will "bypass" the
escaping and pass it do it's version of the do_something() function
without quoting.
Best,
-Rikolaus
--
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