[Python-Dev] datetime module enhancements

Christian Heimes lists at cheimes.de
Sat Mar 10 03:58:27 CET 2007


Brett Cannon schrieb:
> What is wrong with datetime's tzinfo objects?  You need to show why
> datetime is not sufficient and why fixing it is not worth it and how
> it is better to bring in another chunk of code.  And then we can
> discuss code standards, the author of PyTz stepping forward to
> contribute the code and maintain it, etc.

Nothing is wrong with the datetime's tzinfo *class*. PyTz is not an
alternative implementation of the datetime.tzinfo *class*. It's a
database containing several hundreds of datetime.tzinfo *objects* for
various time zones.

More precisely:
The tz objects in PyTz are based on datetime.tzinfo but they are
optimized for static offsets and dynamic offsets from UTC. The objects
are also optimized for size (singletons) and pickling. The package was
written by Stuart Bishop. He is a well known Python developer and known
for high quality code. The code is well written and covered by lots of
unit and doc tests.

>From the README.txt
pytz brings the Olson tz database into Python. This library allows
accurate and cross platform timezone calculations using Python 2.3
or higher. It also solves the issue of ambiguous times at the end
of daylight savings, which you can read more about in the Python
Library Reference (datetime.tzinfo). Amost all (over 540) of the Olson
timezones are supported.

Christian



More information about the Python-Dev mailing list