[issue1289118] timedelta multiply and divide by floating point

Mark Dickinson report at bugs.python.org
Fri May 21 10:42:45 CEST 2010


Mark Dickinson <dickinsm at gmail.com> added the comment:

Alexander, I still don't understand your objection.  What's the downside of allowing the multiplication or division of a timedelta by a float?

Perhaps it's true that there are applications where timedeltas are best viewed as integers (with an implicitt 'microsecond' unit), but I think it's also true that there are plenty of applications where they're just regarded as a representation of a physical quantity, and there this proposal seems entirely appropriate.

I *would* want the timedelta * float and timedelta / float operations to be correctly rounded, so that behaviour is entirely predictable;  the current patch doesn't do that.  But it wouldn't be hard to implement:  there are functions available to express a float as a quotient of two integers, and after that the computation can be performed in integer arithmetic.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1289118>
_______________________________________


More information about the Python-bugs-list mailing list