Author martin.panter
Recipients belopolsky, martin.panter, musically_ut, serhiy.storchaka
Date 2017-05-07.23:41:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1494200503.86.0.639185254091.issue30302@psf.upfronthosting.co.za>
In-reply-to
Content
This was discussed fairly recently: <https://marc.info/?i=CAPTjJmrBxpvYQUYXshBC1J13M_h5or67CNBKrkySw4ef6RqDoQ@mail.gmail.com>. There seems to be a bit of support for changing this. It is not a bug fix, so has to go into the next release, now 3.7.

I disagree that the positional timedelta parameters are well-known.

The built-in help was also discussed in that thread. I don’t think it got fixed yet, did it?

The datetime class represents absolute dates. It is nonsense to specify a date without a year. Timedelta is different, because time is measured with different units. The first parameter (days) is surprising considering most other Python APIs (sleep etc) deal with seconds.

The size of the repr could be reduced a bit by dropping the module name: datetime.timedelta vs just timedelta. Although that would be inconsistent with the other classes; I’m not sure about this.

Other improvements that I would like to see:

1. Drop leading zeros: timedelta(seconds=60) rather than timedelta(days=0, seconds=60). This would also help reduce the size.

2. Factor out the negative sign: -timedelta(seconds=60) rather than timedelta(days=-1, seconds=86340).
History
Date User Action Args
2017-05-07 23:41:43martin.pantersetrecipients: + martin.panter, belopolsky, serhiy.storchaka, musically_ut
2017-05-07 23:41:43martin.pantersetmessageid: <1494200503.86.0.639185254091.issue30302@psf.upfronthosting.co.za>
2017-05-07 23:41:43martin.panterlinkissue30302 messages
2017-05-07 23:41:43martin.pantercreate