[issue5788] datetime.timedelta is inconvenient to use...

Brian Quinlan report at bugs.python.org
Sat Apr 18 22:20:26 CEST 2009


Brian Quinlan <brian at sweetapp.com> added the comment:

OK, a bit on motivation:
1. datetime.timedelta instances are a convenient way of representing
   durations
2. datetime.timedelta instances cannot be conveniently used in many
   calculations e.g. calculating distance based on velocity and time
3. datetime.timedelta instances cannot be conveniently used in many
   library functions e.g. time.sleep(), urllib2.urlopen(timeout=)

I propose to fix that by adding a timedelta.total_seconds attribute that
equals:
timedelta.days * 3600 * 24 + timedelta.seconds + timedelta.microseconds
/ 100000.0

----------

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


More information about the Python-bugs-list mailing list