[issue4291] Allow Division of datetime.timedelta Objects

2009-04-14 Thread Jeremy Banks
Jeremy Banks added the comment: Redundant with #2706 and others. -- nosy: -belopolsky, haypo, marketdickinson status: open -> closed ___ Python tracker ___ _

[issue4291] Allow Division of datetime.timedelta Objects

2008-12-22 Thread STINNER Victor
STINNER Victor added the comment: See related issues: #1289118 and #2706. ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue4291] Allow Division of datetime.timedelta Objects

2008-11-15 Thread Alexander Belopolsky
Alexander Belopolsky <[EMAIL PROTECTED]> added the comment: @Christian Adding a __float__ method to datetime was entertained back in 2003, but was rejected. The same reasons apply to timedelta: """ - A C double doesn't have enough precision for roundtrip guarantees. - Does it really need to

[issue4291] Allow Division of datetime.timedelta Objects

2008-11-15 Thread Mark Dickinson
Mark Dickinson <[EMAIL PROTECTED]> added the comment: [Christian] > float(td1) / float(td2) which is far more obvious than td1 / td2 To me, td1/td2 is more obvious that float(td1)/float(td2). float(td) involves an arbitrary choice, to return time in *seconds* (rather than days, or milliseconds

[issue4291] Allow Division of datetime.timedelta Objects

2008-11-09 Thread Jeremy Banks
Jeremy Banks <[EMAIL PROTECTED]> added the comment: Thanks, I should have paid more attention to the results when I searched for duplicates. I think that Christian's suggestion of enabling float() and int() for timedeltas is worth having here, though. -- nosy: -christian.heimes ___

[issue4291] Allow Division of datetime.timedelta Objects

2008-11-09 Thread STINNER Victor
STINNER Victor <[EMAIL PROTECTED]> added the comment: The issue #1673409 may help: delta1.toseconds() / delta2.toseconds(). ___ Python tracker <[EMAIL PROTECTED]> ___ __

[issue4291] Allow Division of datetime.timedelta Objects

2008-11-09 Thread Jeremy Banks
Jeremy Banks <[EMAIL PROTECTED]> added the comment: Sorry, allowing for conversion to int/float is probably a more sensible solution. This idea was brought to my mind when I was making a very very simple script for a friend to display how far through a time range we currently are. For example:

[issue4291] Allow Division of datetime.timedelta Objects

2008-11-09 Thread STINNER Victor
STINNER Victor <[EMAIL PROTECTED]> added the comment: I don't understand what do you expect with the divison. Can you give an use case and/or examples? -- nosy: +haypo ___ Python tracker <[EMAIL PROTECTED]> _

[issue4291] Allow Division of datetime.timedelta Objects

2008-11-09 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: That's just too weird. A long time ago I suggested to implement __int__ and __float__ on timedelta objects: int(timedelta) -> seconds, float(timedelta) -> seconds.micros. Then your use case could be written as float(td1) / float(td2) which i

[issue4291] Allow Division of datetime.timedelta Objects

2008-11-09 Thread Jeremy Banks
New submission from Jeremy Banks <[EMAIL PROTECTED]>: It would be convenient if it were possible to divide one datetime.timedelta object by another to determine their relative durations. Were the datetime module pure Python a crude solution would just be to add two methods like this: de