YADTR (Yet Another DateTime Rant)
antoon.pardon at rece.vub.ac.be
Wed Mar 26 15:02:15 CET 2014
On 26-03-14 01:58, 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".
There is a difference between how people say things and what is useful.
I remember when I was studying logarithms, a negative number like -5.73
was written down as ̅6.27 (with a bar only over the six). That notation
had the advantage that the part after the decimal point stayed the same
if you added or subtracted whole numbers. Even if that would change the
I can't give an honest estimation of how useful this notation is because
I don't use the datetime module often enough. But I can imagine that those
who wrote the module and I expect used it often found it a useful
More information about the Python-list