YADTR (Yet Another DateTime Rant)
Chris Angelico
rosuav at gmail.com
Thu Mar 27 07:42:26 EDT 2014
On Thu, Mar 27, 2014 at 10:25 PM, Johannes Bauer <dfnsonfsduifb at gmx.de> wrote:
> And it makes it extremely error-prone to the reader:
>
>>>> str(datetime.timedelta(0, -1))
> '-1 day, 23:59:59'
>
> This looks MUCH more like "almost two days ago" than
>
> '-00:00:01'
>
> does.
It's easy when the timedelta is >-1 day. Is it as clear when it's
further negative?
In any case... what I'd suggest would be opening a tracker issue, or
discussing this on python-ideas, and seeing what core devs think of
the matter. I think that, on balance, it's probably better to show the
whole thing with the same sign; but should it be:
>>> str(datetime.timedelta(-1, -1))
'-1 day, 00:00:01'
or should the hyphen be repeated:
>>> str(datetime.timedelta(-1, -1))
'-1 day, -00:00:01'
? How does it read in a larger expression? All this bikeshedding, and
more, available gratis on python-ideas. :)
ChrisA
More information about the Python-list
mailing list