YADTR (Yet Another DateTime Rant)
rosuav at gmail.com
Thu Mar 27 11:44:09 CET 2014
On Thu, Mar 27, 2014 at 9:22 PM, Johannes Bauer <dfnsonfsduifb at gmx.de> wrote:
> Besides, there's an infinite amount of (braindead) timedelta string
> representations. For your -30 hours, it is perfectly legal to say
> 123 days, -2982 hours
> Yet Python doesn't (but chooses an equally braindead representation).
It's not "equally braindead", it follows a simple and logical rule:
Only the day portion is negative. That might not be perfectly suited
to all situations, but it does mean that adding and subtracting whole
days will never change the representation of the time. That's a
reasonable promise. What you propose is completely arbitrary, and yes
it WOULD be braindead to have str() return that (although of course
this should be accepted as input).
> Where can I enter a PIP that proposes that all timedelta strings are
> fixed at 123 days (for positive, non-prime amount of seconds) and fixed
> at -234 days (for all negative or positive prime amount of seconds)?
Doesn't need a PEP. Just subclass it or monkey-patch it and use it as
you will. :)
More information about the Python-list