[Python-Dev] TZ-aware local time

Glyph glyph at twistedmatrix.com
Wed Jun 6 03:31:20 CEST 2012


Le Jun 5, 2012 à 6:16 PM, Nick Coghlan a écrit :

> Personally, I'd like to see the datetime module make an explicit
> assumption that "all naive datetime objects are considered to be UTC",
> with the interactions between naive and aware objects updated
> accordingly

I would absolutely love it if this were true.  In fact, I would go a step further and say that the whole concept of a "naive" datetime is simply a bug.  We don't have a "naive" unicode, for example, where it's text in some encoding but you decline to decide which one when you decode it, leaving that to the caller.

When we addresed this problem for ourselves at Divmod some time ago, naive=UTC is exactly what we did:

<http://bazaar.launchpad.net/~divmod-dev/divmod.org/trunk/files/head:/Epsilon/epsilon/extime.py>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120605/747de3c6/attachment.html>


More information about the Python-Dev mailing list