[Python-ideas] String interpolation for all literal strings

Barry Warsaw barry at python.org
Wed Aug 5 21:53:16 CEST 2015


On Aug 05, 2015, at 03:34 PM, Yury Selivanov wrote:

>On 2015-08-05 2:56 PM, Eric V. Smith wrote:
>> The concept would be that all strings are scanned for \{ and } pairs.

I think it's a very interesting idea too, although the devil is in the
details.  Since this will be operating on string literals, they'd be scanned
at compile time right?

Agreed that raw strings probably shouldn't be scanned.  Since it may happen
that some surprising behavior occurs (long after it's past __future__), there
should be some way to prevent scanning.  To me that either means r'' strings
don't get scanned or f'' is required.  I'm still unclear on what the
difference would be between f'' strings and these currently mythical
scanned-strings are, but I'll wait for the PEP.

>Have you considered using '#{..}' syntax (used by Ruby and
>CoffeeScript)?
>
>'\{..}' feels unbalanced and weird.

As it does for me.  Let's see what particular color Eric reaches for.

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150805/2a886738/attachment.sig>


More information about the Python-ideas mailing list