[Python-Dev] Fixed-decimal types

Jim Fulton jim@digicool.com
Thu, 23 Dec 1999 09:51:14 -0500


While on the subject of RDBMS systems, a common need is to be able to
work with fixed-decimal data.  I think a standard Python fixed-decimal
type would help to make Python database interfaces alot more robust.
I even wonder if the Python long type might be hijacked for this purpose
by adding a "scale" that indicates the number of digits to the right
of the decimal point.  For example, an expression like:

  1000000000.2500L

would create a fixed decimal number with a scale of 4.

People have built Python classes for fixed-decimal
types, but when working with RDBMS data, one often deals with
lots of data and efficiency matters.  I also suspect that adding
scale to longs wouldn't be that hard and would be a fairly natural
extension.

In any case, a "standard" (being in the standard library would
be sufficient) fixed-decimal type would probably lead to better
database interfaces that (at least more) properly handled 
fixed-decimal data.

Jim

--
Jim Fulton           mailto:jim@digicool.com   Python Powered!        
Technical Director   (888) 344-4332            http://www.python.org  
Digital Creations    http://www.digicool.com   http://www.zope.org    

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission.  Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.