Numeric data question

Tim Lavoie tool_man at spamcop.net
Wed Jul 24 11:34:19 EDT 2002


In article <mailman.1027484434.16234.python-list at python.org>, terry wrote:
> 
> I'm a Python newby, but I have read several books, documentation, 
> and email list archives, and I have not found a direct reference 
> to how money calculations can be handled in Python.  
> Specifically, I'ld like to use a Postgres (or any database) 
> numeric data column that represents money with 'normal' Python 
> math operators.  I am *very* aware of the floating point 
> problems, and know that I must avoid even using floating point 
> for accounting applications. 
> 
> Would someone kindly either give me a short explaination or point 
> me toward an information source.
> 
> Thanks in advance,
> 
> terry 

Well, PostgreSQL does have a money type, but IIRC it's just a float with a
fixed number of decimal places. You could just use pennies as the unit and
integer math though.

-- 
"The sign said, 'Jesus is the answer.' Which is kinda weird, since my
question was 'What the hell's this stuff on my sandwich?'"
    -- Phil Bacon



More information about the Python-list mailing list