STINNER Victor <[EMAIL PROTECTED]> added the comment: Some examples to help the choice (using the last patch).
int --- 2L >>> print dt2 * 2 3:08:38 >>> print dt1 - dt2 * 2 0:51:22 >>> divmod(dt1, dt2) (2L, datetime.timedelta(0, 3082)) >>> print timedelta(0, 3082) 0:51:22 In 4 hours, you can watch the movie twice, and then your have 51 minutes left. Operations used: - timedelta // timedelta - timedelta * int - divmod(timedelta, timedelta) float ----- 0.21258172822053367 >>> "Progress: %.1f%%" % ((dt1 / dt2) * 100.0) 'Progress: 21.3%' >>> dt2 * 0.75 ... TypeError: unsupported operand type(s) for *: 'datetime.timedelta' and 'float' >>> print (dt2 * 3) // 4 1:10:44.250000 If you are seen this movie since 20 minutes, you're at 21% of the total. If you want to jump to 75%, it will be at 1:10:44. Note: timedelta * float is not implemented yet. Operations used: - timedelta / timedelta - timedelta * int and timedelta // int (because timdelta / float is not implemented yet) _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2706> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com