[Python-ideas] String interpolation for all literal strings

Nikolaus Rath Nikolaus at rath.org
Sat Aug 8 00:24:04 CEST 2015


On Aug 07 2015, Barry Warsaw <barry-+ZN9ApsXKcEdnm+yROfE0A at public.gmane.org> wrote:
> * Literals only
>
> I've described elsewhere that accepting non-literals is useful in some
> cases.

Are you saying you don't want f-strings, but you want something that
looks like a function (but is actually a special form because it has
access to the local context)? E.g. f(other_fn()) would perform literal
interpolation on the result of other_fn()?

I think that would be a very bad idea. It introduces something that
looks like a function but isn't and it opens the door to a new class of
injection vulnerabilities (every time you return a string it could
potentially be used for interpolation at some point).

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.«
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 997 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150807/76eb7bb0/attachment-0001.sig>


More information about the Python-ideas mailing list