pytz - Python World Timezones

Stuart Bishop zen at
Thu Jun 24 18:36:01 UTC 2004

Hash: SHA1

On 24/06/2004, at 5:54 PM, Paul Eggert wrote:

> Stuart Bishop <zen at> writes:
>> .. _sourceforge:
> Thanks.  I'd like to mention this in tz-links.htm but I'm at a bit of
> a loss as to how to characterize it.  Is it a copy of the tz database,
> or a tz compiler, or some combination of the two?  Clearly your
> approach differs from that of the Python time zones project
> <> but I can't easily put my finger
> on the difference.

Its a transformation of the database into Python source code :-)
How about "A Python timezone implementation with embedded database".

The major difference is that my implementation relies on no
external data files (they are embedded in the generated source code),
and can thus be run on any platform that supports Python 2.3 (including
.net and Java running in a web browser when those ports are brought up
to that standard). The tradeoff is space. I don't know which technique
is faster to load.

I made sure that no data is stored in instances of the tzinfo classes
(just in the class definition itself). This is important when they are
stored persistently, such as in Zope's object database, so that
objects instantiated in previous releases will have the current
timezone data. I do not know if this is the case with Sebastien
Keim's implementation, although it would be possible to make it
behave like this if it doesn't.

I also worked out how to avoid the ambiguous end-of-DST transition
times designed into the Python datetime library, although there is
nothing stopping anyone else using this technique if they want.

For the curious who want to know why I just didn't submit a patch
to the existing project, it was because this code was almost complete
around May 2003. I just never got around to fixing the DST transition
'feature' or getting it release ready until recently due to work

> For example, pytz-2004a.tar.bz2 contains a lot of files saying
> "Generated from the Olson timezone database" but I don't see a copy of
> the program used to generate those files.  Surely this is an important
> part of the project.

This code in the CVS repository at sourceforge is used to generate
the distribution files and the full testsuite.


I'll make a note of this in the README for the next release.

- --  
Stuart Bishop <stuart at>
Version: GnuPG v1.2.3 (Darwin)


More information about the tz mailing list