time, calendar, datetime, etc

John Roth newsgroups at jhrothjr.com
Fri Aug 1 00:02:19 CEST 2003


"A.M. Kuchling" <amk at amk.ca> wrote in message
news:1sScnW0Sv7DzrrSiRTvUpQ at speakeasy.net...
> On Thu, 31 Jul 2003 08:06:29 -0500,
> Skip Montanaro <skip at pobox.com> quoted:
> >     Ben> doing... I'm just a newbie who's found date and time handling
in
> >     Ben> Python to be confusing, and thought I'd mention it. (And I am
the
> >     Ben> original poster, btw.)  If nobody else agrees, maybe it's not
> >     Ben> really a problem.
>
> It's also not very hard to write a PEP; start with an existing PEP for the
> headings, and skim PEP 1 for the PEP life cycle.
>
> Parsing of date/time formats is the big omission from 2.3's date support
and
> the big advantage that mxDateTime still has.  With 2.3 you still have to
> roll your own parser for ISO-8601 format or whatever.  Fixing the rfc822
> module is probably the largest problem; we can't just change getdate() to
> return a datetime instead of a 9-tuple, so it'll have to be supported as a
> new method.  The standard library should probably use datetime as much as
> possible, but backwards-compatible 9-tuple-based interfaces will still
need
> to be supported.

The datetime module is a great piece of work, but I wonder why it
wasn't made more compatible with the time module? It would seem to
be simple enough to provide a sequence interface so the object
supports the 9-tuple directly (for either naive or tz-aware, pick one,)
and also supports the same attributes as the objects in the time package.

I also wonder why anyone made the choice to set the year origin at
1AD? That decision, by itself, makes it almost unusable for my hobby
(astrological software, which is basically astronomical software
with a different focus.) Astronomical dates are always measured
in days since 4700 and something BC. History did not begin, after
all, six years after JC was born. (And astronomical years, btw,
do include a year zero, which historical years do not.)

Other than that, and a couple of other bobbles (depending on the
C library for strftime(), and the lack of an input parser both come
to mind) it's a great piece of work.

John Roth


>
> --amk                                                    (www.amk.ca)
> Hello! I'm the Doctor. I believe you want to kill me.
>       -- The Doctor, in "Silver Nemesis"






More information about the Python-list mailing list