[Python-Dev] Re: PEP 292, Simpler String Substitutions

Guido van Rossum guido@python.org
Wed, 19 Jun 2002 22:50:51 -0400


> The distinction between %()s and %()r, recently introduced, has been
> useful.  But with str() and repr(), only one of those is really
> necessary.  But it gave the impression that Python trend is pushing
> for % to get stronger.  The proposal of using $ as yet another
> formatting avenue makes it weaker.

Language evolution doesn't always go into a straight line.

> > Less clutter.  Compare
> 
> >     "My name is $name, I live in $country"
> 
> > to
> 
> >     "My name is ${name}, I live in ${country}"
> 
> > The {} add nothing but noise.  We're copying this from the shell.
> 
> Noise decreases legibility.  So, maybe the PEP should not say that
> ${name} is to be preferred over $name?  Or else, it should explain
> why.

I agree that I see no reason to prefer ${name} (except when followed
by another word character of course).

--Guido van Rossum (home page: http://www.python.org/~guido/)