This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author musically_ut
Recipients belopolsky, martin.panter, musically_ut, serhiy.storchaka
Date 2017-05-08.00:42:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
> This was discussed fairly recently: <>

That thread went deep and culminated here, as far as I can tell: (I may not have explored all the branches, though.)

So there indeed seems to be general agreement about changing this. It was heartening to know that I wasn't the only one to stumble. \o/

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

No, the doc-string is as uninformative as then, as far as I can tell:

  In [178]: datetime.timedelta?
  Init signature: datetime.timedelta(self, /, *args, **kwargs)
  Docstring:      Difference between two datetime values.
  File:           ~/miniconda3/lib/python3.5/
  Type:           type 

I'll investigate what documentation for other functions looks like and see if I can come up with something better. The exact documentation would be best discussed over diffs on Github.

Then there is the issue of repr being explicitly documented, as you had pointed out on the Github issue. Guido thinks that any breakage is _unlikely_ but "asked around" here:

As far as I can tell, he didn't see an explicit response.

> 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.

Personally, I don't see a big problem either way but having datetime.timedelta in the repr feels reassuring to me that I have the 'right' type instead of some other 'timedelta' from a non-stdlib module (e.g. moments or pandas).

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

This sounds reasonable. I'll make this change and add corresponding tests.

> 2. Factor out the negative sign: -timedelta(seconds=60) rather than timedelta(days=-1, seconds=86340).

I'm not sure there was consensus about this; if I understand correctly, Guido thinks that it is important that the repr return what the attributes hold:
Date User Action Args
2017-05-08 00:42:52musically_utsetrecipients: + musically_ut, belopolsky, martin.panter, serhiy.storchaka
2017-05-08 00:42:52musically_utsetmessageid: <>
2017-05-08 00:42:52musically_utlinkissue30302 messages
2017-05-08 00:42:50musically_utcreate