[Python-Dev] Re: Update PEP 292 (original) (raw)

Barry Warsaw barry at python.org
Wed Aug 11 15:58:03 CEST 2004


On Wed, 2004-08-11 at 08:21, Andrew Durdin wrote:

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?

The elimination of the trailing 's' is definitely a benefit, as is the adoption of $-placeholders, since that tends to be the placeholder introducing character in many other languages. In terms of usability, it's a win.

-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/20040811/9ab236ac/attachment.pgp



More information about the Python-Dev mailing list