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

spir denis.spir at free.fr
Sat Mar 14 08:49:46 CET 2009


Le Fri, 13 Mar 2009 23:08:18 -0700,
"Raymond Hettinger" <python at rcn.com> s'exprima ainsi:

>  Since the apostrophe is much harder to
> > mistake for a period than a comma is, I would modify my "just a flag"
> > suggestion to use an apostrophe as the flag instead of a comma:  
>  . . .
> > The output would still use commas though:  
> 
> That doesn't make sense for two reasons:
> 1.  Why mark a non-locale aware form with a flag that indicates
>      locale awareness in another language.
> 2.  It seems to be basic bad design to require an apostrophe
>      to emit commas.

If I properly understand the PEP (by the way, congratulations for the reformulation -- the motivation section esp. is clearer and more motivat-ing) there are 2 differences between the poposals:
* choose char for thousand-sep
* choose decimal sep

> FWIW, the comma-only version of the proposal is probably going to 
> die anyway.  The more flexible alternative evolved to something simple
> and direct.  Also, the newsgroup discussion make it abundantly clear 
> that half the world will rebel if commas are the only supported option.  

If the first proposal let the user choose the thousand-sep char it would be more appealing, indeed. As is, it has no chance.
Anyway, the second proposal is now rather clear and simple. In my mind, both separators work together even when there no possible conflict between the actual chars.
+1 for version #2 (more or less as is now)

I would just add:
   The SPACE can be either U+0020 (standard space) or U+00A0 (non-breakable space).

Denis

PS - OT: As the width param is the width of whole number, how to cope with with decimal point alignment, meaning that there should be integral part width/padding instead?
      123.45
        1.2
   123456.789
Maybe this need is mainly in the financial field, so that this will be implicitly addressed because to the 2-digit rounding?
      123.45
        1.20
   123456.79
------
la vita e estrany



More information about the Python-ideas mailing list