[Python-Dev] Can we please have a better dict interpolation syntax?

Barry Warsaw barry at python.org
Thu Oct 23 10:53:15 EDT 2003

On Thu, 2003-10-23 at 08:31, François Pinard wrote:
> [Guido van Rossum]
> > > > Wouldn't this be even better?
> > > >     "create index ${table}_lid1_idx on $table($lid1)" % params
> "Better" because it uses `$' instead of `%'? It is really a matter of
> taste and aesthetics, more than being "better" on technical grounds.
> Technically, the multiplication of aspects and paradigms goes against
> some unencumberance and simplicity, which made Python attractive to
> start with.  We would loose something probably not worth the gain.

Better because the trailing type specifier on %-strings is extremely
error prone (#1 cause of bugs for Mailman translators is/was leaving off
the trailing 's').  Better because the rules for $-strings are simple
and easy to explain.  Better because the enclosing braces are optional,
and unnecessary in the common case, making for much more readable
template strings.  And yes, better because it uses $ instead of %; it
just seems that more people grok that $foo is a placeholder.


-------------- 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/20031023/81a3c016/attachment.bin

More information about the Python-Dev mailing list