[Python-Dev] Add UTC to 2.7 (PyCon sprint idea)

anatoly techtonik techtonik at gmail.com
Thu Feb 18 13:41:33 CET 2010


On Tue, Feb 16, 2010 at 1:52 PM, Victor Stinner
<victor.stinner at haypocalc.com> wrote:
>> So far, Python timezone handling is far from "pythonic". There is no
>> function to get current UTC offset, (...)
>
> There is the time.timezone attribute: UTC offset in seconds.

It is correct only if DST is not in effect.

On Tue, Feb 16, 2010 at 5:26 PM, Tres Seaver <tseaver at palladion.com> wrote:
>
> skip at pobox.com wrote:
>>
>> While incorporating dateutil into the core would be nice (in my opinion at
>> least), I was really thinking of pytz: http://pytz.sourceforge.net/
>
> Because timezones are defined politically, they change frequently.  pytz
> is released frequently (multiple times per year) to accomodate those
> changes:  I can't see any way to preserve that flexibility if the
> package were part of stdlib.

Actual TZ information can be shipped with every Python release, but..
If pytz package is available and it's newer - library functions may
use its data instead. Of course, this should be documented as official
way to maintain TZ info up-to-date.

If pytz to be included in standard library - it should still be
distributed as separate package to provide more frequent TZ updates
and updates to older Python versions.


On Wed, Feb 17, 2010 at 1:32 PM, Lennart Regebro <regebro at gmail.com> wrote:
> There is no need to stick Pytz in the standard library. It's available
> on PyPI, updated frequently, etc. What we can do is point to it from
> the documentation.

It will still require workarounds and bridges to make API in user
scripts convenient, i.e.

try:
  import pytz
  mydatetime = PytzDatetime()
catch ImportError:
  mydatetime = ClassicDatetime()

The goal is to reduce workarounds and avoid repeated code in Python scripts.



Leaving pytz aside, does everybody feel comfortable with setting a
Wave for API design of date/time issues and the stuff to be done? If
there will be an API draft and current list of stuff - I can try to do
some work in "offline" mode.

-- 
anatoly t.


More information about the Python-Dev mailing list