In message <[EMAIL PROTECTED]>,
Steven D'Aprano wrote:

> On Wed, 27 Sep 2006 20:16:52 +0200, Fredrik Lundh wrote:
> 
>> Claes at work wrote:
>> 
>>> Please tell me there is a simpler way than subtracting two datetimes
>>> to get a timedelta and then compute
>>> 
>>> days * number of seconds per day + seconds
>>> 
>>> from it myself??
>> 
>> why would you have to do that yourself?  why not let Python do it for
>> you?  here's the code:
>> 
>>     seconds = td.days * 86400 + td.seconds
> 
> I'm sure somebody as experienced as Fredrik doesn't need to be told why
> peppering code with magic constants like 84600 are a less than ideal
> solution...

Certainly a constant like 86400 would be better.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to