[Numpy-discussion] Difficulty using special types like timedelta and Decimal

Benjamin Root ben.root at ou.edu
Fri Sep 16 11:11:10 EDT 2011

Certain numerical types in Python that support accurate fractional
calculations such as timedelta and Decimal do not allow for multiplication
or division by a floating point number, but do allow for use with an
integer.  This can cause difficulties with some functions such as
np.gradient() which has a division by 2.0 as part of the algorithm.

My question is: with Py3k's division always resulting in a floating point
result regardless of the denominator's type, would it be possible to change
some of these common denominators over to integers in order to better
facilitate support for these special types?

Obviously, I don't think we could expect full support of these types, but
maybe a mechanism could be developed to better handle these?

Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110916/291801ef/attachment.html>

More information about the NumPy-Discussion mailing list