[issue2706] datetime: define division timedelta/timedelta

STINNER Victor report at bugs.python.org
Fri Nov 14 19:28:41 CET 2008


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

Since timedelta(3) // 2 is already accepted, divmod should also accept 
integers (but not float).

With the last patch and "from __future__ import division", we support:
  timedelta // <timedelta or int>
  timedelta / timedelta
  divmod(timedelta, timedelta)

What do you think about:
  timedelta / <timedelta or int or float>  # only with __future__.divison
  timedelta // <timedelta or int>
  timedelta % <timedelta or int>
  divmod(timedelta, <timedelta or int>)
with:
  timedelta // int -> timedelta
  timedelta // timedelta -> int
  timedelta % int -> timedelta
  timedelta % timedelta -> int
  divmod(timedelta, int) -> (timedelta, timedelta)
  divmod(timedelta, timedelta) -> (int, timedelta)
  timedelta / <anything> -> float # __future__.divison

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


More information about the Python-bugs-list mailing list