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

Guido van Rossum guido at python.org
Tue Mar 17 00:06:12 CET 2009


On Mon, Mar 16, 2009 at 4:02 PM, Raymond Hettinger <python at rcn.com> wrote:
>> I also have to say that I find Eric's proposal a bit ambiguous: why
>> shouldn't {:8,d} mean "insert commas between thousands"?
>
> It does.  That is the sixth example listed:
>
>  format(1234, "8.1f")     -->    '  1234.0'
>  format(1234, "8,1f")     -->    '  1234,0'
>  format(1234, "8.,1f")    -->    ' 1.234,0'
>  format(1234, "8 ,f")     -->    ' 1 234,0'
>  format(1234, "8d")       -->    '    1234'
>  format(1234, "8,d")      -->    '   1,234'
>  format(1234, "8_d")      -->    '   1_234'

Argh! So "8,1f" means "use comma instead of point" wherease "8,1d"
means "use comma as 1000 separator"? You guys can't seriously propose
that.

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



More information about the Python-ideas mailing list