[Patches] [ python-Patches-1118748 ] enable time + timedelta

SourceForge.net noreply at sourceforge.net
Tue Feb 8 17:56:12 CET 2005


Patches item #1118748, was opened at 2005-02-08 16:56
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1118748&group_id=5470

Category: Modules
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Josh (josh-sf)
Assigned to: Nobody/Anonymous (nobody)
Summary: enable time + timedelta

Initial Comment:
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)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1118748&group_id=5470


More information about the Patches mailing list