[issue18629] future division breaks timedelta division by integer

Alexander Belopolsky report at bugs.python.org
Sat Aug 3 20:35:51 CEST 2013


Alexander Belopolsky added the comment:

> I just want `timedelta / int` to do the same thing in Python 2.7
> with __future__.division as `timedelta / int` does in Python 3.

It other words you want to backport timedelta / int true division.  I am afraid it is 3-4 years too late for this request, but I will let others make a call.  Count me as -0.

I usually prefer explicit error over an obscure bug.  If we backport true division the -Qnew flag will be changing the meaning of timedelta / int very slightly: instead of rounding down it will round to nearest.  There are cases where this difference is important.  Furthemore, when people compare timedeltas in tests they rarely do it with precision tolerance.  If you have a good test coverage change from floor to true division may break your tests.

My recommendation is: replace timedelta / int with timedelta // int in your 2.x code.

----------

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


More information about the Python-bugs-list mailing list