pytz - Python World Timezones

Stuart Bishop zen at shangri-la.dropbear.id.au
Thu Jun 24 18:36:01 UTC 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


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

> Stuart Bishop <zen at shangri-la.dropbear.id.au> writes:
>
>> .. _sourceforge: http://sourceforge.net/projects/pytz/
>
> 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
> <http://s.keim.free.fr/tz/doc.html> 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
commitments.

> 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.

Details: http://sourceforge.net/cvs/?group_id=79122
Browse: http://cvs.sourceforge.net/viewcvs.py/pytz/pytz/

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

- --  
Stuart Bishop <stuart at stuartbishop.net>
http://www.stuartbishop.net/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (Darwin)

iD8DBQFA2x8RAfqZj7rGN0oRAk/UAJsH4xJuKaYWdYCxInNfoMKarBRUzQCgmUOY
uRrehtGuKQZeQhz6UobY4VQ=
=oqyz
-----END PGP SIGNATURE-----




More information about the tz mailing list