YADTR (Yet Another DateTime Rant)
jeanmichel at sequans.com
Wed Mar 26 10:53:16 CET 2014
----- Original Message -----
> One of my roles on this newsgroup is to periodically whine about
> stupidities in the Python datetime module. This is one of those
> I have some code which computes how long ago the sun set. Being a
> pythonista, I'm using a timedelta to represent this value. It would
> 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
> 1 day ago plus 22 hours and 25 minutes".
I can think of a less useful default way:
previous sunset: 1 sunset ago
This is how humans have been saying things for thousands of years before inventing the clock.
Beside that, I think datetime has all the formatters required to do pretty much anything.
Note : I don't see what's wrong in your example, however I have the feeling the term "stupiditie" is a little bit strong ;)
-- IMPORTANT NOTICE:
The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
More information about the Python-list