Decimal() instead of float?
steve at holdenweb.com
Tue Nov 14 18:08:56 CET 2006
Michael B. Trausch wrote:
> On Mon, 2006-11-13 at 03:45 -0600, Steve Holden wrote:
>> Michael B. Trausch wrote:
>> > Is there a way to use Decimal() by default in Python instead of float?
>> No. You'll just have to be explicit.
> That's kinda what I figured. :-(
> It /would/ be nice to see Decimal() become the default. I cannot
> imagine why in an otherwise "human enough" language, math wouldn't be
> included in that without going out of one's way to do it. :-)
Speed has a lot to do with it. Have you timed some decimal operations
against their floating-point counterparts? It might be possible to build
a version of Python that used decimal instead of floating-point but it
certainly wouldn't be trivial: consider the use of C language libraries
that know nothing of Python's decimal representation.
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden
More information about the Python-list