pep proposal : A date object for the standard library

Robin Becker robin at jessikat.fsnet.co.uk
Wed Dec 12 11:26:08 CET 2001


In article <pcosnaho36o.fsf at thoth.home>, Harald Hanche-Olsen
<hanche at math.ntnu.no> writes
....
>No, no, no.  I never meant to advocate a TimeOfDay class without
>reference to the date.  If you need to specify a time, you need the
>date to go with it, or the time is useless.  So there should be a Date
>or Calendar class that merely understands dates and calendars, with no
>reference to time of day.  And there should be a Time class, which
>specifies a time by giving both the date (from the former class) and a
>time of day.  (Complete with time zone information.)  All I'm saying
>is that the first module needs to be nailed down dead solid before
>you even start tackling the second.
>
I agree with this approach, but would beg the implementors of the Date
class to allow for the possibility of different sequencing. For example
I have modified NormalDate to get a subclass of NormalDate that does
business dates (ie misses out Sat/Sun), but that also has a sequence
representation (scalar value) that is gapless. With a BD corresponding
to a Monday subtracting 1 gives a BD of the preceding Friday. There are
also many other useful date 'frequencies' eg weekly, monthly, quarterly
yearly etc etc. 
-- 
Robin Becker



More information about the Python-list mailing list