[Datetime-SIG] Calendar vs timespan calculations...

Alexander Belopolsky alexander.belopolsky at gmail.com
Sat Aug 1 21:58:54 CEST 2015


On Sat, Aug 1, 2015 at 3:40 PM, Ethan Furman <ethan at stoneleaf.us> wrote:
> If this new 'strict' support still has buggy behaviour around time shifts,
> why are we bothering?

Because the new 'strict' way of dealing with timezones and datetime
arithmetics will become our "gold standard" and we will not tolerate
buggy behavior even in the corner cases?

Speaking seriously, however,  the part that I really want to salvage
is Tim's clever algorithm that implements fromutc() once the user
provided utcoffset() and dst() methods.

This algorithm relies on a technically illegal operation: calling
utcoffset() and dst() on a datetime instance representing time in UTC.
If we allow utcoffset() or dst() raise an error on some values of
datetime - this algorithm won't work.

[1]: https://hg.python.org/cpython/file/f6a3310d3cc9/Lib/datetime.py#l957


More information about the Datetime-SIG mailing list