<div dir="ltr"><div class="gmail_quote">On Sat, Nov 5, 2011 at 4:22 PM, Arnaud Delobelle <span dir="ltr"><<a href="mailto:arnodel@gmail.com">arnodel@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

On 5 November 2011 14:07, Ram Rachum <<a href="mailto:ram.rachum@gmail.com">ram.rachum@gmail.com</a>> wrote:<br>
> (Sorry for possible double-post, Google Groups was doing weird things.)<br>
> Hey,<br>
> I'm currently writing code that's manipulating `datetime.timedelta` objects.<br>
> I get one and I need to check whether it's positive or negative.<br>
> I can't really think of an elegant way to do this.<br>
> Here's one:<br>
>     my_timedelta >= datetime.timedelta(0)<br>
> Another one:<br>
>     my_timedelta.total_seconds() >= 0<br>
><br>
> Perhaps we should allow a more elegant way? Possibly `my_timedelta >= 0` for<br>
> 0 only?<br>
><br>
> Thanks,<br>
> Ram.<br>
> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
><br>
><br>
<br>
(That's more of a question for <a href="http://c.l.py" target="_blank">c.l.py</a>)<br>
<br>
Simpler:<br>
<br>
my_timedelta.days >= 0<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Arnaud<br>
</font></span></blockquote></div><div><br></div>Shorter, yeah, but still weird. I'm making a calculation involving microseconds and suddenly I deal with days? Pretty weird.<br><br clear="all"><div><br></div>-- <br>Sincerely,<br>

Ram Rachum<br>
</div>