[Python-Dev] Decimal conversion to string (original) (raw)

Greg Ewing greg at cosc.canterbury.ac.nz
Thu Apr 15 21:22:57 EDT 2004


Aahz <aahz at pythoncraft.com>:

Right. Question is, to what extent does "human readable" factor in after these criteria?

In the case of Decimal, I think it's fairly clear that

Decimal("123.45")

is the winner overall, since both the type and value are unambiguous and easily readable, and it's eval-able to boot.

On the other hand, I see absolutely zero utility in displaying the tuple-form of the internals.

From the point of view of using the interactive interpreter as a desk calculator, it might be slightly more desirable to see

Decimal(123.45)

but that wouldn't be eval-able. For such use it might be better to have a special calculator-mode interpreter that took all numeric literals as Decimal and displayed them unadorned.

Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg at cosc.canterbury.ac.nz +--------------------------------------+



More information about the Python-Dev mailing list