[Python-Dev] Change the repr for datetime.timedelta (was Re: Asynchronous context manager in a typical network server)

Chris Barker chris.barker at noaa.gov
Mon Dec 21 17:07:56 EST 2015


On Sun, Dec 20, 2015 at 2:28 PM, Chris Angelico <rosuav at gmail.com> wrote:

>
> Would there be value in changing the repr to use keyword arguments?
>

this thread got long, but it sounds like that won't be worth the backwards
compatibility...


> Worse, help(datetime.timedelta) in 3.6 doesn't document the
> constructor at all. There's no mention of __init__ at all, __new__ has
> this useless information:
>

but this seems to have gotten lost in the shuffle.

and aside from there being three data descriptors, there's nothing to
> suggest that you construct these things with timedelta(days, seconds,
> microseconds). Definitely no indication that you can use other keyword
> args.
>
> Is this something worth fixing, or is it acceptable to drive people to
> fuller documentation than help()?
>

Absolutlye worht fixing! maybe it' sjsut my weird workflow, but I find it
very, very useful to use iPython's ? :

In [10]: datetime.timedelta?
Docstring: Difference between two datetime values.File:
 ~/miniconda2/lib/python2.7/lib-dynload/datetime.so
Type:      type

and there are a LOT of next-to worthless docstrings in the stdlib -- it
would be nice to clean them all up.

Is there any reason not to, other than someone having to do the work?

-Chris



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20151221/877b6300/attachment.html>


More information about the Python-Dev mailing list