[Python-Dev] Re: Alternative ImplementationforPEP292:SimpleString Substitutions

Barry Warsaw barry at python.org
Mon Sep 13 03:49:37 CEST 2004


On Sat, 2004-09-11 at 04:39, "Martin v. Löwis" wrote:

> No, I think Brett (and apparently nearly everybody else) thinks that
> such a template will not be written over the course of the next five
> years, except for demonstration purposes. Instead, what will be written
> is u'¿Puede volver $today o $tomorrow?' because the template will be
> a translation of the original English template, and, during translation,
> placeholder names must not be changed (although I have difficulties
> imagining possible values for today or tomorrow so that this becomes
> meaningful).
> 
> > If end users always follow the rules, this will never come up.  If they
> > don't, should there be error message or a silent failure?
> 
> There is always a chance of a silent failure in SafeTemplates, even with
> this rule added - this is the purpose of SafeTemplates. With a Template,
> you will get a KeyError. In any case, the failure will not be completely
> silent, as the user will see $mañana show up in the output.
> 
> My prediction is that the typical application is to use Templates, as
> users know very well what the placeholders are. Furthermore, the
> typical application will use locals/globals/vars(), or dict(key="value")
> to create the replacement dictionary. In this application, nobody
> would even think of using mañana as a key, because you can't get
> it into the dictionary.
> 
> If this never comes up, it is better to not complicate the rules.
> Simple is better than complex.

I tend to agree, so I'd like to keep the rules as they currently stand. 
Your prediction is aligned with what I think the most common use cases
are too.

-Barry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: This is a digitally signed message part
Url : http://mail.python.org/pipermail/python-dev/attachments/20040912/fe37123b/attachment.pgp


More information about the Python-Dev mailing list