[DB-SIG] Accepted method for handling decimals?

Carsten Haese carsten at uniqsys.com
Mon Nov 28 16:40:29 CET 2005

Hi everybody:

I am planning to implement support for decimals in InformixDB
(http://informixdb.sourceforge.net) using the python decimal module if
it's available. My question is, should fetches simply return Decimal
instances instead of floats, or should there be some kind of
configuration setting to choose whether to return floats or Decimals? If
so, on what level should that setting reside, module, connection, or

I am leaning towards providing an optional argument to the Cursor()
constructor for turning on Decimal handling, and by default the cursor
would return floats. My reasoning here is that returning Decimals would
incur a (small) performance penalty that the user should only have to
pay if they need the precision that using Decimals gives them. As far as
the name of this optional argument, I'm considering "use_decimal", but
I'm open to suggestions.

Comments are welcome.

Best regards,

Carsten Haese.

More information about the DB-SIG mailing list