On 26/03/2014 01:19, Ethan Furman wrote:
On 03/25/2014 05:58 PM, Roy Smith wrote:
One of my roles on this newsgroup is to periodically whine about
stupidities in the Python datetime module.  This is one of those times.

I have some code which computes how long ago the sun set.  Being a nice
pythonista, I'm using a timedelta to represent this value.  It would be
difficult to imagine a less useful default way to print a timedelta:

previous sunset: -1 day, 22:25:26.295993

The idea of str() is that it's supposed to return a human-friendly
representation of a value.  Humans do not say things like, "The sun set
1 day ago plus 22 hours and 25 minutes".

I'm not sure whether to admire you for your stick-to-it-iveness, or pity
you for the plight you are in.  Either the first or second time I hit a
datetime WTF moment I wrote my own wrapper classes.


dateutils for me.

--
My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language.

Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to