[Python-Dev] Replacement for print in Python 3.0
Steven Bethard
steven.bethard at gmail.com
Thu Sep 1 23:29:32 CEST 2005
Reinhold Birkenfeld wrote:
> Raymond Hettinger wrote:
> > 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).
>
> But then, a format() function would be necessary (equivalent to sprintf)
Does it have to be a function? I'd expect it to be a method, like
string.Template. E.g
>>> '%s: %i'.substitute('badger', 42)
badger: 42
>>> '%(name)s: %(count)i'.substitute(name='badger', count=42)
badger: 42
BTW, I'm quite happy with the current string formatting format. I
certainly haven't "taken issue with the trailing s in %(myvar)s". If
it wasn't there, when it is for %(count)i and %(ratio)f, I'd probably
wonder why.
STeVe
--
You can wordify anything if you just verb it.
--- Bucky Katt, Get Fuzzy
More information about the Python-Dev
mailing list