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

Victor Stinner victor.stinner at haypocalc.com
Tue Feb 16 12:52:06 CET 2010


Hi,

Le Tuesday 16 February 2010 11:38:05 anatoly techtonik, vous avez écrit :
> 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.

> One of the reasons I see is that date/time functions are
> implemented in C, they expose C API, and there are not many people who
> can help and patch them.

Is it no possible to extend Python datetime module in Python?

There are already 3rd party libraries:

http://pypi.python.org/pypi/pytz
http://pypi.python.org/pypi/django-timezones
http://www.egenix.com/products/python/mxBase/mxDateTime/
...

Can't why integrating an existing module (well tested, with a documentation, 
an user base, etc.)?

> I am sure many current Python users will appreciate UTC functions and
> improved date/time API more than any new language features.

Sure, the current API is complex and has few documentation.

> That's why I would like to propose this enhancements for a coding spring on
> forthcoming PyCon.

Excellent idea :)

--

There are also some interesting open issues about the datetime module:

http://bugs.python.org/issue1289118 - timedelta multiply and divide by 
floating point
http://bugs.python.org/issue1673409 - datetime module missing some important 
methods
http://bugs.python.org/issue2706 - datetime: define division 
timedelta/timedelta
http://bugs.python.org/issue2736 - datetime needs and "epoch" method

Bugs about old timestamps:

http://bugs.python.org/issue1726687 - Bug found in datetime for Epoch time 
= -1
http://bugs.python.org/issue1777412 - Python's strftime dislikes years before 
1900
http://bugs.python.org/issue2494 - Can't round-trip datetimes<->timestamps 
prior to 1970 on Windows

Victor


More information about the Python-Dev mailing list