[Python-Dev] Sort out formatting differences in decimal and float
dickinsm at gmail.com
Sat Dec 5 15:13:19 CET 2009
On Sat, Dec 5, 2009 at 1:18 PM, <skip at pobox.com> wrote:
> >>> format(Decimal(1234), '020,g')
> >>> format(Decimal(1234), '0=20,g')
> Why in the world would you ever want to insert commas as separators and not
> use them consistently?
So should commas be inserted for any fill character at all? Or should
only '0' be special-cased? What about other digits used as fill characters?
What about other non-ascii zeros? Should those be special-cased too?
I'm reluctant to add extra special cases and complication to what's
already quite a complicated specification; it seems better to keep
it simple (well, as simple as possible) and orthogonal.
There's already a good way to ask for zero padding, by using the leading
zero, as in '020,g'. Why would you use '0=20,g' instead? I'm not sure
that the 'X=...' notation was intended to be used for zero padding.
More information about the Python-Dev