Message47733
This patch enables timedelta arithmetic for times (in
addition to dates and datetimes). Tests and doc included
Here's a response to the probable reason why this
hasn't been enabled already...
Times greater than 24 hours should not raise an
exception, but always wrap around. Any other behavior
is too surprising. (People expect to be able to call
you up at 11pm, and say "meet me in two hours" (if
you're a night person)).
Clock time is cyclical. Though it's convenient to
assign hours numbers, an unqualified hour 23.5 is not
naturally "greater than" hour 0.5. (Though I'm not
suggesting that we break this.)
The special meaning for hour 0 is only relevant for
datetimes. When dates are not involved, it shouldn't
get any special treatment. When dates are involved,
it's easy to "assert datetime1.date() == datetime2.date()"
If this change is made however, maybe
datetime.timedelta(hours=-1) should no longer normalize
to datetime.timedelta(-1, 82800) |
|
Date |
User |
Action |
Args |
2007-08-23 15:41:44 | admin | link | issue1118748 messages |
2007-08-23 15:41:44 | admin | create | |
|