[Python-Dev] Replacement for print in Python 3.0
Raymond Hettinger
raymond.hettinger at verizon.net
Thu Sep 1 20:20:40 CEST 2005
> > Actually, formatting needs to become a function. The overloading of
the
> > arithmetic mod operator has proven to be unfortunate (if only
because of
> > precedence issues).
>
> For me, it's not so much the precedence, but the fact that "%s" % x
> doesn't work as expected if x is a tuple; you'd have to write "%s" %
> (x,) which is tedious.
Right. That too.
> > Also, the format coding scheme itself needs to be revisited. There
is
> > no shortage of people who have taken issue with the trailing s in
> > %(myvar)s.
>
> Maybe the syntax used in the class is the way to go?
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.
Raymond
More information about the Python-Dev
mailing list