[Python-Dev] Change the repr for datetime.timedelta (was Re: Asynchronous context manager in a typical network server)
Alexander Belopolsky
alexander.belopolsky at gmail.com
Sun Dec 20 20:00:53 EST 2015
More information about the Python-Dev mailing list
Sun Dec 20 20:00:53 EST 2015
- Previous message (by thread): [Python-Dev] Change the repr for datetime.timedelta (was Re: Asynchronous context manager in a typical network server)
- Next message (by thread): [Python-Dev] Change the repr for datetime.timedelta (was Re: Asynchronous context manager in a typical network server)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Dec 20, 2015 at 5:28 PM, Chris Angelico <rosuav at gmail.com> wrote: > > A helpful trivia: a year is approximately π times 10 million seconds. > > Sadly doesn't help here, as the timedelta for a number of years looks like > this: > > >>> datetime.timedelta(days=365*11) > datetime.timedelta(4015) > > The original issue was how long is a million seconds. The bit of trivia that I suggested helps to establish that it cannot be a multiple of years. > Would there be value in changing the repr to use keyword arguments? > I don't think translating from seconds to years will be any simpler with any alternative repr, but I would really like to see a change in the repr of negative timedeltas: >>> timedelta(minutes=-1) datetime.timedelta(-1, 86340) And str() is not much better: >>> print(timedelta(minutes=-1)) -1 day, 23:59:00 The above does not qualify as a human readable representation IMO. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20151220/4cbac1eb/attachment.html>
- Previous message (by thread): [Python-Dev] Change the repr for datetime.timedelta (was Re: Asynchronous context manager in a typical network server)
- Next message (by thread): [Python-Dev] Change the repr for datetime.timedelta (was Re: Asynchronous context manager in a typical network server)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list