[Python-Dev] TZ-aware local time (original) (raw)

Guido van Rossum guido at python.org
Wed Jun 6 00:49:41 CEST 2012


On Tue, Jun 5, 2012 at 3:33 PM, Alexander Belopolsky <alexander.belopolsky at gmail.com> wrote:

On Tue, Jun 5, 2012 at 6:07 PM, Guido van Rossum <guido at python.org> wrote:

I've also been arguing against "local time" tzinfo

Why? I don't see your argumentation against such a tzinfo in the bug See http://bugs.python.org/issue9063 . The problem is again the DST ambiguity.  One day a year, datetime(y, m, d, 1, 30, tzinfo=Local) represents two different times and another day it represents no valid time.  Many applications can ignore this problem but stdlib should not.

This seems the blocking issue. We disagree on whether the stdlib should not offer this functionality because it cannot do so perfectly.

The documentation example (fixed in issue 9063) addresses the ambiguity by defaulting to standard time, but it does this at a cost of having no way to spell "the other hour."

Again, this is a problem of DST and timezones, and not something you can ever "fix" (even if DST would be abandoned worldwide tomorrow, it would still remain a problem for historic times). We should just acknowledge the problem, implement the best we can do, document the limitation, and move on. Apps that care should just use some other way to represent local time.

-- --Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list