[Python-ideas] string.Template v2

Steven D'Aprano steve at pearwood.info
Fri Nov 29 01:58:14 CET 2013


On Thu, Nov 28, 2013 at 06:53:07PM +0100, Victor Stinner wrote:

> In my opinion, string.Template alone is almost useless (it's probably
> why it is not used).

I've used it.

In my opinion, string.Template is not aimed at the programmer, but at 
the end-user. As a programmer, string.Template is very underpowered and 
much less convenient than either % string interpolation or str.format. 
But as an end-user, sometimes all I need is basic string templating 
without all the complicated features of % and {} formatting. For that 
simple use-case $name templates are all I want and a much nicer look 
than Anatoly's suggested {{name}}.

If Anatoly wishes to create a new templating engine using {{}}, I 
encourage him to do so, but he should leave string.Template alone.

(I'm not opposed to enhancements to Template, but I am opposed to 
radically overhauling it into something completely different.)


-- 
Steven


More information about the Python-ideas mailing list