A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-December/094429.html below:

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

[Python-Dev] Sort out formatting differences in decimal and floatMark Dickinson 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')
>    '0,000,000,000,001,234'
>    >>> format(Decimal(1234), '0=20,g')
>    '0000000000000001,234'
>
> 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.

Mark
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4