[Python-ideas] String interpolation for all literal strings

Chris Angelico rosuav at gmail.com
Thu Aug 6 02:26:48 CEST 2015


On Thu, Aug 6, 2015 at 10:13 AM, Andrew Barnert <abarnert at yahoo.com> wrote:
>> Whether or not it's good for string literals to support interpolation,
>> though, I'm not sure about. The idea that stuff should get
>> interpolated into strings fits a shell scripting language perfectly,
>> but I'm not fully convinced it's a good thing for an applications
>> language. How shelly is Python? Or, what other non-shell languages
>> have this kind of feature? PHP does (which is hardly an
>> advertisement!); I can't think of any others off hand, any pointers?
>
> Guido's specific inspiration was Swift, which is about as "applicationy" a language as you can get.

Thanks. If anyone else wants to read up on that:

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/StringsAndCharacters.html

I poked around with a few Swift style guides, and they seem to assume
that interpolation is a good and expected thing, which is promising.
No proof, of course, but the converse would have been strong evidence.

Count me as +0.5 on this.

ChrisA


More information about the Python-ideas mailing list