Guido van Rossum wrote:
I propose adding an "abstract" money base type to the standard library, to be subclassed by real money/decimal implementations.
Why do we need this? I guess that would be Question #1...
For databases ?! The DB API has long had a monetary or at least decimal type on its plate... never got around to implementing one, though :-)
I can only find one reference to money or decimal in the DB API PEP, and that's as a future task. I guess that's what you mean by "on its plate".
Since I'm not a database expert, maybe you can explain the use of this in more detail? And why would we need a monetary type rather than a fixed-point decimal type?
A decimal would do as well, I suppose, at least in terms of storing the raw value. The reason for trying to come up with a monetary type is to make operations between monetary values having two different currencies illegal. Coercion between two of those would always have to be made explicit (for obvious reasons).
-- Marc-Andre Lemburg CEO eGenix.com Software GmbH