<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">We already have a slew of templating utilities (see Cheetah for example).<br></blockquote>first of all -- i know there's a bunch of templating engines, but i think it should be a
<br>built-in feature of the language. like boo does. and estr is stronger than simple <br>$name substitution, like Template does.<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
Be sure to stay aware of the security risks if the fill-in values are user specified.<br></blockquote>that's one major benefit of having it as a builtin type -- you dont have security risks,<br>as the expression itself is embedded in your code, not something you get from the
<br>outside:<br><br>name = raw_input(&quot;what's you name?&quot;)<br>print e&quot;hello {name}&quot;<br><br>does not get the *expression* from the user, only the *values*, so unless the user<br>causes a buffer overflow with a huge string, he can't run code. the estr object is part 
<br>of *your* code, which you trust. <br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">If you need this, then consider using a third-party templating module.
<br></blockquote>that 50-liner estr class i presented does just that.<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">Using the key twice is basic to templating (once of specify where to
<br>make the substitution and once to specify its value). &nbsp;This is no<br>different from using variable names in regular code: &nbsp; a=1; ... ; b =<br>a+2 &nbsp;# variable-a is used twice.<br></blockquote>but when it's defined once as an argument to a function, once in the template,
<br>and once in the dict, that's three times, where it can be only two.<br><br>def f(name):<br>&nbsp;&nbsp;&nbsp; print e&quot;hello {name}&quot;<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">
Also, the example is misleading because real-apps are substitute<br>variables, not constants. &nbsp;IOW, the above code fragment is sematically<br>equivalent to: &nbsp;print &quot;hello john&quot;.</blockquote><div><br>what do you mean by that?
<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">3) it is less<br>flexible than &nbsp;the class constructor which can be subclassed and<br>
extended as needed.<br></blockquote></div>do you often subclass str? it's a built-in type, part of the language, subclassing it doesnt<br>make much sense. after all it's the language compiler that instanciates these types, 
i.e.,<br>when you do &quot;hello&quot;, the compiler creates an instance of str() with that value, not you<br>directly, and that's the case here.<br><br><br>-tomer<br><br><div><span class="gmail_quote">On 4/20/06, <b class="gmail_sendername">
Raymond Hettinger</b> &lt;<a href="mailto:rhettinger@ewtllc.com">rhettinger@ewtllc.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>&gt;<br>&gt;If you don't like the $name style of template markup and prefer<br>&gt;delimiters instead, then check-out the recipe at:<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/3053">
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/3053</a><br>&gt;<br>&gt;<br>The link should have been:<br><br>&nbsp;&nbsp; <a href="http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305306">http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305306
</a><br><br><br><br></blockquote></div><br>