]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
datetime.timedelta is now subclassable in Python. The new test shows
authorTim Peters <tim.peters@gmail.com>
Sat, 17 May 2003 15:57:00 +0000 (15:57 +0000)
committerTim Peters <tim.peters@gmail.com>
Sat, 17 May 2003 15:57:00 +0000 (15:57 +0000)
commitb0c854d6a747cd64ff7b23b8e9f9ef93ff8ac0ac
tree367f74e70138c99155a965da3707f05d8095ecdc
parent108c40c74c5f3169b9095b464b3e868171571ff6
datetime.timedelta is now subclassable in Python.  The new test shows
one good use:  a subclass adding a method to express the duration as
a number of hours (or minutes, or whatever else you want to add).  The
native breakdown into days+seconds+us is often clumsy.  Incidentally
moved a large chunk of object-initialization code closer to the top of
the file, to avoid worse forward-reference trickery.
Lib/test/test_datetime.py
Misc/NEWS
Modules/datetimemodule.c