<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 1, 2015 at 1:44 PM, Tim Peters <span dir="ltr"><<a href="mailto:tim.peters@gmail.com" target="_blank">tim.peters@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">[Alex]<br>
<span class="">> Here is an idea that I think may work: let's consider fold=1 instances as if<br>
> they have a different tzinfo instance from the other side in both datetime<br>
> subtractions and comparisons.  This will be consistent with the current<br>
> stdlib and pytz work-arounds of representing "second" times using fictitious<br>
> fixed-offset timezones.<br>
<br>
</span>That's what I was getting at by saying "fold=1 veritably _screams_<br>
'I'm no longer working in naive time'".  Which implies "I need<br>
timeline arithmetic", and everything else follows from that, including<br>
hash() not ignoring fold=1 either.<br>
<br>
But then the concept of "naive time" gets muddier:  sometimes, e.g.,<br>
<br>
     dt1  - dt2<br>
<br>
in a common zone (same tzinfo) will use classic arithmetic, but in<br>
other cases (fold=1 in at least one) timeline arithmetic.<br></blockquote><div><br></div><div>I don't think this is a problem as long as we disallow mixing naive and aware instances in arithmetic and ordering and keep naive ≠ aware always rule.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
And there's also that, after<br>
<br>
    d = dt1 - dt2<br>
<br>
I suspect it may no longer always be the case that<br>
<br>
    dt1 == dt2 + d<br>
<br>
(unsure, but can't make time for it now)<br></blockquote><div><br></div><div>That's the price we pay for classic arithmetic anyways.  I am not even sure we want to trigger timeline arithmetics in dt + delta expressions when dt.fold=1.  If you do, dt - hour + hour will still not take you back because the seconds + hour will be classic.</div><div><br></div><div>I don't think we can ever get rid of all paradoxes here.  Once you let your time go back, all bets are off.  What we can do is to shift them from one place to another so that you only see odd behavior when a fold=1 instance is involved. </div></div><br></div></div>