[Python-ideas] String interpolation for all literal strings

Dan Sommers dan at tombstonezero.net
Thu Aug 6 05:02:04 CEST 2015


On Thu, 06 Aug 2015 12:32:12 +1000, Chris Angelico wrote:

> On Thu, Aug 6, 2015 at 12:20 PM, Dan Sommers <dan at tombstonezero.net> wrote:

>> Common Lisp's format string is an entire DSL, but that DSL is like
>> printf in that the string describes the formatting and the remaining
>> arguments to the format function provide the data, rather than the
>> string naming local variables or containing expressions to be
>> evaluated.

> Lots of languages have some sort of printf-like function (Python has
> %-formatting and .format() both), where the actual content comes from
> additional arguments. It's the magic of having the string *itself*
> stipulate where to grab stuff from that's under discussion here.

Yes, I agree.  :-)

Perhaps I should have said something like, "...that DSL *remains* like
printf...."  I tried to make the argument that non-shelly languages
should stay away from that magic, but it apparently didn't come out the
way I wanted it to.



More information about the Python-ideas mailing list