Alternative to Decimal type

Terry Reedy tjreedy at
Wed Jun 11 21:22:49 CEST 2008

"Frank Millman" <frank at> wrote in message 
news:f7cc4f0f-3e37-43e7-927a-0ed14a063930 at
| Thanks to all for the various replies. They have all helped me to
| refine my ideas on the subject. These are my latest thoughts.
| Firstly, the Decimal type exists, it clearly works well, it is written
| by people much cleverer than me, so I would need a good reason not to
| use it. Speed could be a good reason, provided I am sure that any
| alternative is 100% accurate for my purposes.

The Decimal module is a Python (now C coded in 2.6/3.0, I believe) 
implementation of a particular IBM-sponsored standard.  The standard is 
mostly good, but it is somewhat large with lots of options (such as 
rounding modes) and a bit of garbage (the new 'logical' operations, for 
instance) added by IBM for proprietary purposes.  Fortunately, one can 
ignore the latter once you recognize them for what they are.

As Nick indicated, it is not the first in its general category.  And I 
believe the Decimal implementation could have been done differently.

By writing you own class, you get just what you need with the behavior you 
want.  I think just as important is the understanding of many of the issues 
involved, even if you eventually switch to something else.  That is a 
pretty good reason in itself.


More information about the Python-list mailing list