[Python-Dev] Sort out formatting differences in decimal and float

Eric Smith eric at trueblade.com
Sat Dec 5 15:20:26 CET 2009


Mark Dickinson wrote:
> I find it odd that, for float formatting, the choice of fill character
> affects whether commas are inserted:
> 
> Python 3.2a0 (py3k:76671, Dec  4 2009, 18:55:54)
> [GCC 4.2.1 (Apple Inc. build 5646) (dot 1)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>>>> format(float(1234), '0=20,g')
> '0,000,000,000,001,234'
>>>> format(float(1234), '1=20,g')
> '1111111111111111,234'
>>>> format(float(1234), 'X=20,g')
> 'XXXXXXXXXXXXXXX1,234'

I haven't spent a lot of time looking at it, but this might be related 
to http://bugs.python.org/issue6902 .

I'll move this up in my queue.

Eric.



More information about the Python-Dev mailing list