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

Eric Smith eric at trueblade.com
Sun Mar 15 18:28:56 CET 2009

Scott David Daniels wrote:
> Still doesn't specify to digits beyond the decimal point.  I don't
> really care what the choice is, but I do care that the choice is
> specified.  Is the precision in digits, or is it width of the post-
> decimal point field?  If the latter, does a precision of 4 end with
> a comma or not?
> In particular, what should (format(9876.54321, "13,.5f"),
> format(9876.54321, "12,.4f")) produce?
> Possible "reasonable" answers:
>    A   '  9,876.54321', '  9,876.5432'
>    B   ' 9,876.543,21', ' 9,876.543,2'
>    C   '  9,876.543,2', '  9,876.543,'
>    D   '  9,876.543,2', '   9,876.543'
> I prefer B, but I can see an argument for any of the four above.

The C locale functions don't support grouping to the right of the 
decimal. I don't think I've ever seen a system that supports it. Do you 
have any examples?

I'd say A.


More information about the Python-ideas mailing list