Message75670
| Author |
Jeremy Banks |
| Recipients |
Jeremy Banks |
| Date |
2008年11月09日.23:57:53 |
| SpamBayes Score |
4.6159654e-05 |
| Marked as misclassified |
No |
| Message-id |
<1226275075.64.0.889084103082.issue4291@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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:
def toMicroseconds(self):
return ((self.days * 24 * 60) + self.seconds * 1000000) +
self.microseconds
def __truediv__(self, other):
return self.toMicroseconds() / other.toMicroseconds()
However, I don't understand know the Python C API well enough to know
how to patch the C module. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2008年11月09日 23:57:55 | Jeremy Banks | set | recipients:
+ Jeremy Banks |
| 2008年11月09日 23:57:55 | Jeremy Banks | set | messageid: <1226275075.64.0.889084103082.issue4291@psf.upfronthosting.co.za> |
| 2008年11月09日 23:57:54 | Jeremy Banks | link | issue4291 messages |
| 2008年11月09日 23:57:53 | Jeremy Banks | create |
|