[DB-SIG] ODMG Date/time classes
Thu, 18 Dec 1997 10:18:15 +0100
At 16:20 1997-12-17 -0500, Jim Fulton wrote:
> def __mul__(self, anInt):
> """Multiply an interval by an integer"""
> def __div__(self, anInt):
> """Divide an interval by an integer"""
Why not allow floats? I assume you've just copied the standard,
but what would be the reason for not allowing mult and div with
floats? Seconds is float, so division should handle a floating
point result anyway. It seems like an arbitrary restriction.=20
I'm not quite sure what integer divition and remainder would
mean for a time interval. If it had just been defined as days
I would get it, but since it is defined to fractions of seconds...
I think mod and divmod mistakes. They really only make sense when both
nominator and denominator are integers. They don't make sense when the
interval is a compound where it's unclear what the unit is.
Somehow, it seems that if t =3D 5 days, then t div 2 =3D 2 and t rem 2 =3D=
but t =3D 5 days =3D 120 hours =3D> t div 2 =3D 60 hours (=3D 2=BD days), t=
mod 2 =3D 0!!!=20
> [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday
> ] =3D range(7)
This seems to contradict the ISO standard which starts with Monday.
There were just Americans in the group that developed this, right? ;-)
Date could certainly benefit from having methods ISO_year() and
ISO_week(). We use week numbers frequently in Sweden for instance.
If a pocket or wall calender lacked week numbers it would certainly
be considered flawed.
It would also be good to have methods for Date and Timestamp that
returned aTimeTime, so that integration with the time module can
work both ways. This somehow needs to handle TZ. localtime() and
gmtime() I guess.
PS In Lithuanian (my wife's mother tongue) Monday is pirmadienis (first
day), Tuesday is antradienis (second day) and so on. No discussion about
which day the week starts with. :-) No, Sunday is not nuliadienis, it's
sekmadienis (seventh day)!
Magnus Lycka, S/W Engineer, M.Sc.E.E; Folktrov. 6C, 907 51 Umea, Sweden
Tel: +46(0)90 198 498, GSM: +46(0)70 582 80 65, Fax: +46(0)70 612 80 65
DB-SIG - SIG on Tabular Databases in Python
send messages to: email@example.com
administrivia to: firstname.lastname@example.org