PEP 327: Decimal Data Type

Aahz aahz at pythoncraft.com
Thu Feb 5 15:16:51 CET 2004


In article <6ltk10h30riel0lghd18t5unjco2g26spi at 4ax.com>,
Stephen Horne  <steve at ninereeds.fsnet.co.uk> wrote:
>On Fri, 30 Jan 2004 09:49:05 -0300, "Batista, Facundo"
><FBatista at uniFON.com.ar> wrote:
>>
>>I'll apreciate any feedback. Thank you all in advance.
>
>My concern is that many people will use a decimal type just because it
>is there, without any consideration of whether they actually need it.
>
>95% of the time or more, all you need to do to represent money is to
>use an integer and select appropriate units (pence rather than pounds,
>cents rather than dollars, etc) so that the decimal point is just a
>presentation issue when the value is printed/displayed but is never
>needed in the internal representation.

The problem lies precisely in that representation.  For starters, a
binary integer is O(n^2) for conversion to decimal printing.  Then
there's the question about multi-currency conversions, or interest
rates, or ....
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"The joy of coding Python should be in seeing short, concise, readable
classes that express a lot of action in a small amount of clear code -- 
not in reams of trivial code that bores the reader to death."  --GvR



More information about the Python-list mailing list