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

spir denis.spir at free.fr
Tue Mar 17 16:36:51 CET 2009


Le Tue, 17 Mar 2009 15:12:20 +0000,
Mark Dickinson <dickinsm at gmail.com> s'exprima ainsi:

> On Tue, Mar 17, 2009 at 2:58 PM, Eric Smith <eric at trueblade.com> wrote:
> > And what happens when the comma would be the first character?
> >
> > ,012,345
> > 0012,345
> >
> > or something else?
> 
> Options are:
> 
> (A) ",012,345"
> (B) "0012,345"
> (C) " 012,345"
> (D) "0,012,345"
> (E) write-in option here
> 
> I vote for (D):  it's one character too large, but the given precision
> is only supposed to be a minimum anyway.  We already end up
> with a length-9 string when formatting 1234567.
> 
> (D) is the minimum width string that:
>   doesn't look weird (like (A) and (B)),
>   has length at least 8, and
>   is still in the right basic format
> 
> (C) would be my second choice, but I find the extra space padding
> to be somewhat arbitrary (why a space? why not some other
> padding character?)

I agree with all the comments above.

* A is ... (censured).
* B does not comply with user choice.
* D is the best in theory, but would trouble table-like vertical alignment.
* So remains only C for me.

Also, the issue here comes from user inconsistency: a (total) width of 8 simply cannot fit with group separators every 3 digits (warning?). At best, there should be some information on this topic to avoid bad surprises, but then the implementation should not care much.

> Mark

Denis
------
la vita e estrany



More information about the Python-ideas mailing list