Rough draft: Proposed format specifier for a thousands separator

John Machin sjmachin at lexicon.net
Thu Mar 12 08:58:50 EDT 2009


On Mar 12, 9:56 pm, Raymond Hettinger <pyt... at rcn.com> wrote:
> [Ulrich Eckhardt]
>
> > IOW, why not explicitly say what you want using keyword arguments with
> > defaults instead of inventing an IMHO cryptic, read-only mini-language?
>
> That makes sense to me but I don't think that's the way the format()
> builtin was implemented (see PEP 3101 which was implemented Py2.6 and
> 3.0).
> It is a simple pass-through to a __format__ method for each
> formattable
> object.  I don't see how keywords would fit in that framework.  What
> is
> proposed is similar to locale module's existing "n" specifier except
> that
> this lets you say exactly what you want instead of deferring to the
> locale
> settings.
>
> The mini-language seems to already be the way of things (just as it is
> many other languages including PHP, C, Fortran, and whatnot).  I'm
> just
> proposing an addition "T," so you add commas as a thousands separator.
>

... and why not C (centum) for hundreds (can't have H(ollerith)) and W
for wan (the Chinese word for 10 thousand)?





More information about the Python-list mailing list