A RetroSearch Logo

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

Search Query:

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

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

[Python-Dev] Sort out formatting differences in decimal and floatskip at pobox.com skip at pobox.com
Sat Dec 5 14:18:37 CET 2009
Sorry for being a curmudgeon, however...

    >>> 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?

    >>> format(Decimal('nan'), '020,g')
    '                 NaN'
    >>> format(Decimal('nan'), '0=20,g')
    '00000000000000000NaN'

Why in the world would you ever want to zero pad Nan (or Inf, for that matter)?

    Stefan> The advantage of decimal is that the user has the option to
    Stefan> suppress commas. The behaviour of float is slightly easier to
    Stefan> implement in C.

Why?  If the user asked for them why would you want to suppress (some of)
them?

Skip
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