<div dir="ltr">We're now thoroughly in python-ideas land.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 21, 2015 at 7:39 AM, Random832 <span dir="ltr"><<a href="mailto:random832@fastmail.com" target="_blank">random832@fastmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Guido van Rossum <<a href="mailto:guido@python.org">guido@python.org</a>> writes:<br>
> I'm sure that one often catches people by surprise. However, I don't<br>
> think we can fix that one without also fixing the values of the<br>
> attributes -- in that example days is -1 and seconds is 86340 (which<br>
> will *also* catch people by surprise). And changing that would be<br>
> much, much harder for backwards compatibility reasons-- we'd have to<br>
> set days to 0 and seconds to -60, and suddenly we have a much murkier<br>
> invariant, instead of the crisp<br>
><br>
> 0 <= microseconds < 1000000<br>
> 0 <= seconds < 60<br>
<br>
</span>I don't really see it as murky:<br>
<br>
0 <= abs(microseconds) < 1000000<br>
0 <= abs(seconds) < 60<br>
(days <= 0) == (seconds <= 0) == (microseconds <= 0)<br>
(days >= 0) == (seconds >= 0) == (microseconds >= 0)<br>
<br>
The latter are more easily phrased in english as "all nonzero<br>
attributes have the same sign". I think the current behavior is<br>
rather as if -1.1 were represented as "-2+.9". The attributes<br>
probably can't be fixed without breaking backwards<br>
compatibility, though. How about "-timedelta(0, 60)"?<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/guido%40python.org" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/guido%40python.org</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">--Guido van Rossum (<a href="http://python.org/~guido" target="_blank">python.org/~guido</a>)</div>
</div>