[Python-Dev] Store timestamps as decimal.Decimal objects (original) (raw)

Jim J. Jewett jimjjewett at gmail.com
Thu Feb 16 20:20:43 CET 2012


In http://mail.python.org/pipermail/python-dev/2012-February/116073.html Nick Coghlan wrote:

Besides, float128 is a bad example - such a type could just be returned directly where we return float64 now. (The only reason we can't do that with Decimal is because we deliberately don't allow implicit conversion of float values to Decimal values in binary operations).

If we could really replace float with another type, then there is no reason that type couldn't be a nearly trivial Decimal subclass which simply flips the default value of the (never used by any caller) allow_float parameter to internal function _convert_other.

Since decimal inherits straight from object, this subtype could even be made to inherit from float as well, and to store the lower- precision value there. It could even produce the decimal version lazily, so as to minimize slowdown on cases that do not need the greater precision.

Of course, that still doesn't answer questions on whether the higher precision is a good idea ...

-jJ

--

If there are still threading problems with my replies, please email me with details, so that I can try to resolve them. -jJ



More information about the Python-Dev mailing list