[Python-ideas] Rough draft: Proposed format specifier for a thousands separator (discussion moved from python-dev)

Guido van Rossum guido at python.org
Mon Mar 16 22:05:47 CET 2009

On Mon, Mar 16, 2009 at 12:19 PM, Raymond Hettinger <python at rcn.com> wrote:
> The conversation on the thousands separator seems to have wound down
> and the PEP has stabilized:  http://www.python.org/dev/peps/pep-0378/
> Please pronounce.

That's not a PEP, it's just a summary of a discussion without any
choice. :-) Typically PEPs put the discussion of alternatives in some
section at the end, after the specification and other stuff relevant
going forward.

Just to add more fuel to the fire, did anyone propose refactoring the
problem into (a) a way to produce output with a thousands separator,
and (b) a way to localize formats? We could solve (a) by adding a
comma to all numeric format languages along Nick's proposal, and we
could solve (b) either now or later by adding some other flag that
means "use locale-specific numeric formatting for this value". Or
perhaps there could be two separate flags corresponding to the
grouping and monetary arguments to locale.format(). I'd be happy to
punt on (b) until later.

This is somewhat analogous to the approach for strftime() which has
syntax to invoke locale-specific formatting (%a, %A, %b, %B, %c, %p,
%x, %X).

I guess in the end this means I am in favor of Nick's alternative.

One thing I don't understand: the PEP seems to exclude the 'e' and 'g'
format. I would think that in case 'g' defers to 'f' it should act the
same, and in case it defers to 'e', well, in the future (under (b)
above) that could still change the period into a comma, right?

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

More information about the Python-ideas mailing list