Il giorno lun, 28/11/2005 alle 10.40 -0500, Carsten Haese ha scritto:
> 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
> cursor?

I'd return decimals by default (actually psycopg 2 does.) If the
programmer uses a money or decimal column then it probably does not want
the rouding errors of float point numbers. He will be more than happy to
incur in a small performance penalty to have "exact" numbers.

About the configuration, psycopg just allow the programmer to override
any of the default "type caster" functions with a user-defined one.
Really usefull.

federico

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                [EMAIL PROTECTED]
INIT.D Developer                                           [EMAIL PROTECTED]
                        Su grappe nessuno è innocente. -- Natale Titotto

Attachment: signature.asc
Description: Questa parte del messaggio è firmata

_______________________________________________
DB-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/db-sig

Reply via email to