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

Scott David Daniels Scott.Daniels at Acm.Org
Sun Mar 15 17:58:53 CET 2009


Raymond Hettinger wrote:
> Todays updates to:  http://www.python.org/dev/peps/pep-0378/
> 
> * Summarize commentary to date.
> * Add APOSTROPHE and non-breaking SPACE to the list of separators.
> * Add more links to external references.
> * Detail issues with the locale module.
> * Clarify how proposal II is parsed.
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.


--Scott David Daniels
Scott.Daniels at Acm.Org




More information about the Python-ideas mailing list