[Python-Dev] Alternative Implementation for PEP 292: Simple String Substitutions

Raymond Hettinger python at rcn.com
Sat Aug 28 21:20:37 CEST 2004


> > When application is remote from instantiation (for instance, when a
> > template argument is supplied to a function), we get several
problems.
> > Given a line like "r = t % m", it is hard to verify that the code is
> > correct.  Should there be KeyError trapping?  Can m be a tuple? Is t
a
> > %template, a safetemplate, or dollartemplate?  Is the result a str
or
> > Unicode object?  Should the decision of safe vs regular substitution
be
> > made at the point of instantiation or application?

[Aahz]
> All right, this moves me to +1, in the absence of any good arguments
in
> favor of keeping the class-based system.

FWIW, I've loaded the proposed improvements to the sandbox:

   \nondist\sandbox\string\alt292.py

It includes a doctest section that illustrates all of the improvements
in action (appropriate return type, error handling, commenting, code
simplicity, keyword arguments, function API, etc).

I'm not sure what to do next.  Aside from Aahz, no one on python-dev
seems to be interested and Barry appears to have been off-line for a few
days.  Ideally, I would like to get this in a few days ahead of the
alpha release.


Raymond



More information about the Python-Dev mailing list