[Python-Dev] Replacement for print in Python 3.0

Shane Hathaway shane at hathawaymix.org
Thu Sep 1 22:02:39 CEST 2005

Guido van Rossum wrote:
> On 9/1/05, Raymond Hettinger <raymond.hettinger at verizon.net> wrote:
>>string.Template is a bit too simplified.  But perhaps it can be adapted.
>>We still want some way to express %r, %6.2f, etc.    Since string
>>formatting has been around since Tim was in diapers, we should probably
>>start by looking at the solutions used by other languages.  With Py3.0,
>>we have a real opportunity to break-away from doing things the way C
>>does it.
> Hrm. Most other languages these days do floating point formatting the
> way C does it. I'm happy to look for other ways to invoke the thing,
> but I think that we shouldn't tinker with %6.2f. (In fact, the major
> complaint is about the one place where I *did* tinker with it --
> %(boo)s.)
> Maybe the ${boo} form can be extended to allow ${boo%6.2f} ??? 
> Unfortunately that would prevent a different extension of ${boo}: %{boo+far}.

May I also suggest the following shortcut for creating and evaluating a 
string template.  (Ever since I thought of this, I've actually used this 
in code without thinking... it's just too natural):

   message = $"Hello, $name!"


More information about the Python-Dev mailing list