[New-bugs-announce] [issue4291] Allow Division of datetime.timedelta Objects

Jeremy Banks report at bugs.python.org
Mon Nov 10 00:57:55 CET 2008


New submission from Jeremy Banks <jeremy at jeremybanks.ca>:

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.

----------
components: Library (Lib)
messages: 75670
nosy: Jeremy Banks
severity: normal
status: open
title: Allow Division of datetime.timedelta Objects
type: feature request

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


More information about the New-bugs-announce mailing list