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

Victor Stinner victor.stinner at gmail.com
Tue Dec 22 03:39:20 EST 2015


repr() with keywords is called a method, no? Like isoformat()

Victor

Le lundi 21 décembre 2015, Guido van Rossum <gvanrossum at gmail.com> a écrit :

> I still think the repr change to use keywords has a good chance for 3.6.
>
> --Guido (mobile)
> On Dec 21, 2015 2:09 PM, "Chris Barker" <chris.barker at noaa.gov
> <javascript:_e(%7B%7D,'cvml','chris.barker at noaa.gov');>> wrote:
>
>> On Sun, Dec 20, 2015 at 2:28 PM, Chris Angelico <rosuav at gmail.com
>> <javascript:_e(%7B%7D,'cvml','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
>> <javascript:_e(%7B%7D,'cvml','Chris.Barker at noaa.gov');>
>>
>> _______________________________________________
>> Python-Dev mailing list
>> Python-Dev at python.org
>> <javascript:_e(%7B%7D,'cvml','Python-Dev at python.org');>
>> https://mail.python.org/mailman/listinfo/python-dev
>> Unsubscribe:
>> https://mail.python.org/mailman/options/python-dev/guido%40python.org
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20151222/3f2a9c7b/attachment.html>


More information about the Python-Dev mailing list