[Python-Dev] Re: Update PEP 292

Andrew Durdin adurdin at gmail.com
Wed Aug 11 14:21:57 CEST 2004


On Wed, 11 Aug 2004 06:06:12 -0600, Fernando Perez <fperez528 at yahoo.com> wrote:
> Barry Warsaw wrote:
> 
> > Raymond and I had a chance to talk about PEP 292 on bug day, and we've
> > exchanged a few private emails and implementations.  I think we've
> > finally knocked everything into shape for inclusion in Python 2.4's next
> > alpha.
> >
> > In the sandbox you will find the updated implementation, along with
> > updated tests and documentation (libstring.tex).
> >
> > The updated PEP is at:
> >
> > http://www.python.org/peps/pep-0292.html

Forgive me for being obtuse, but I can't see anything significantly
simpler in this PEP than the standard string interpolation, except for
the case where the identifier doesn't need braces:

template("Hello, $name, how are you?") % {name: "Jim"}
versus
"Hello, %(name)s, how are you?") % {name: "Jim"}

Apart from removing the need for the parentheses/braces in this case,
all it does is consistently remove the "s", and replace the % with $,
and then limiting the interpolated values to strings (or will it
automatically use str(x) for any non-string variable x?).
Is there any other benefit to this that I'm overlooking?


More information about the Python-Dev mailing list