[Datetime-SIG] Another round on error-checking

Tim Peters tim.peters at gmail.com
Tue Sep 1 19:44:47 CEST 2015


[Alex]
> Here is an idea that I think may work: let's consider fold=1 instances as if
> they have a different tzinfo instance from the other side in both datetime
> subtractions and comparisons.  This will be consistent with the current
> stdlib and pytz work-arounds of representing "second" times using fictitious
> fixed-offset timezones.

That's what I was getting at by saying "fold=1 veritably _screams_
'I'm no longer working in naive time'".  Which implies "I need
timeline arithmetic", and everything else follows from that, including
hash() not ignoring fold=1 either.

But then the concept of "naive time" gets muddier:  sometimes, e.g.,

     dt1  - dt2

in a common zone (same tzinfo) will use classic arithmetic, but in
other cases (fold=1 in at least one) timeline arithmetic.

And there's also that, after

    d = dt1 - dt2

I suspect it may no longer always be the case that

    dt1 == dt2 + d

(unsure, but can't make time for it now)


More information about the Datetime-SIG mailing list