Re: [Datetime-SIG] Another round on error-checking
[Tim]
The easiest way out of this particular puzzle is, I believe, to say that two datetimes identical except for `fold` do _not_ compare equal. `fold` breaks the tie in the obvious way (the one with fold==1 is "greater").
[Alex]
I am afraid you are right, but proving that we will not break naive (fold unaware) programs will be harder in this case. Let me think some more about this.
Meanwhile, would you see any problem with not(x - y) not implying x == y?
Which is another puzzle :-( It's very intentional now that dt1 == dt2 if and only if dt1 - dt2 == timedelta(0) Here's a related puzzle, if comparison used `fold` to break ties: y = x + timedelta(0) If x had first=1, y will have fold=0, and then x != y. In all, maybe it's better to leave __hash__ slightly broken.
participants (1)
-
Tim Peters