[Datetime-SIG] Another approach to 495's glitches

Tim Peters tim.peters at gmail.com
Mon Sep 7 03:19:08 CEST 2015


[Alex]
>> For me, subtraction in this case is similar to conversion.  Fix the EPOCH
>> and d = t - EPOCH together with t = EPOCH + d gives you a bijection between
>> times and timedeltas.

[Tim]
> Well, not without more words to clarify which operations are intended.
> For example, it's impossible to tell what "-" means there unless you
> spell out whether you're using classic or timeline arithmetic.  In
> order to make your final claim true, I have to (I believe)
> reverse-engineer that the claim is restricted to naive EPOCH and `d`,
> or aware datetimes in a common fixed-offset zone. Otherwise your "-"
> uses timeline arithmetic and your "+" classic arithmetic, and they're
> different kinds of arithmetic in a non-fixed-offset zone.

I'm missing a case there:  common non-fixed-offset zone.  That one
doesn't fail because different kinds of arithmetic are used (classic
is always used then), but because classic arithmetic ignores `fold`
entirely - there's no bijection in that case if you're viewing `t` as
civil time.

So, your EPOCH and ` t` share a common (possibly None) tzinfo, and
you're talking about a bijection in naive (not civil) time.


More information about the Datetime-SIG mailing list