[Python-ideas] String interpolation for all literal strings

Nick Coghlan ncoghlan at gmail.com
Thu Aug 6 08:27:27 CEST 2015


On 6 August 2015 at 16:05, Nathaniel Smith <njs at pobox.com> wrote:
> I'm by no means prepared to mount a full defense / work out details / write
> a PEP of this idea this week, but since IMO ! really is the only obvious
> character to use for this, and now we seem to be talking about other uses
> for the ! character, I wanted to get it on the radar...

Fortunately, using "!" as a string prefix doesn't preclude using it
for the case you describe, or even from offering a full compile time
macro syntax as "!name(contents)".

It's one of the main reasons I like it over "$" as the marker prefix -
it fits as a general "compile time shenanigans are happening here"
marker if we decide to go that way in the future, while "$" is both
heavier visually and very specific to string interpolation.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-ideas mailing list