Re: [Python-Dev] Docstrings on builtins

2018-06-06 Thread Chris Barker via Python-Dev
On Tue, Jun 5, 2018 at 8:01 AM, Ivan Pozdeev wrote: > In [5]: print(str.__doc__) > str(object='') -> str > str(bytes_or_buffer[, encoding[, errors]]) -> str > > Create a new string object from the given object. If encoding or > errors is specified <...> > As you can see, the start of the type's d

Re: [Python-Dev] Docstrings on builtins

2018-06-05 Thread Ivan Pozdeev via Python-Dev
On 05.06.2018 17:56, Chris Barker wrote: OK, looking a bit deeper: In [69]: timedelta.__new__.__doc__ Out[69]: 'Create and return a new object.  See help(type) for accurate signature.' In [70]: timedelta.__init__.__doc__ Out[70]: 'Initialize self.  See help(type(self)) for accurate signature

Re: [Python-Dev] Docstrings on builtins

2018-06-05 Thread Chris Barker via Python-Dev
OK, looking a bit deeper: In [69]: timedelta.__new__.__doc__ Out[69]: 'Create and return a new object. See help(type) for accurate signature.' In [70]: timedelta.__init__.__doc__ Out[70]: 'Initialize self. See help(type(self)) for accurate signature.' In [71]: timedelta.__doc__ Out[71]: 'Diff

Re: [Python-Dev] Docstrings on builtins

2018-06-04 Thread Matthias Bussonnier
On Mon, 4 Jun 2018 at 17:29, Ivan Pozdeev via Python-Dev < python-dev@python.org> wrote: > On 05.06.2018 3:09, Matthias Bussonnier wrote: > > This may even be a bug/feature of IPython, > > I see that inspect.signature(timedelta) fails, so if timedelta? says > Init signature: timedelta(self, /, *a

Re: [Python-Dev] Docstrings on builtins

2018-06-04 Thread Chris Barker - NOAA Federal via Python-Dev
> > This may even be a bug/feature of IPython, Ahh, thanks! I’ll look into that. -CHB ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/

Re: [Python-Dev] Docstrings on builtins

2018-06-04 Thread Ivan Pozdeev via Python-Dev
On 05.06.2018 3:09, Matthias Bussonnier wrote: This may even be a bug/feature of IPython, I see that inspect.signature(timedelta) fails, so if timedelta? says Init signature: timedelta(self, /, *args, **kwargs) Then this may be some IPython internal logic. The timedelta class seem to use __new_

Re: [Python-Dev] Docstrings on builtins

2018-06-04 Thread Matthias Bussonnier
This may even be a bug/feature of IPython, I see that inspect.signature(timedelta) fails, so if timedelta? says Init signature: timedelta(self, /, *args, **kwargs) Then this may be some IPython internal logic. The timedelta class seem to use __new__ instead of __init__ (not sure why) and __new__

Re: [Python-Dev] Docstrings on builtins

2018-06-04 Thread Chris Barker via Python-Dev
On Mon, Jun 4, 2018 at 3:27 PM, Victor Stinner wrote: > For Argument Clinic, have a look at > https://docs.python.org/dev/howto/clinic.html Thanks Victor -- scanning that page, it is indeed where I needed to look. You can also try to copy/paste code from other files using Argument > Clinic and

Re: [Python-Dev] Docstrings on builtins

2018-06-04 Thread Victor Stinner
Hi, For Argument Clinic, have a look at https://docs.python.org/dev/howto/clinic.html You can also try to copy/paste code from other files using Argument Clinic and then run "make clinic" to regenerate the generated files. Victor 2018-06-04 23:45 GMT+02:00 Chris Barker via Python-Dev : > Over o

[Python-Dev] Docstrings on builtins

2018-06-04 Thread Chris Barker via Python-Dev
Over on python-ideas, someone is/was proposing literals for timedeltas. I don't expect that will come to anything, but it did make me take a look at the docstring for datetime.timedelta. I use iPython's ? a lot for a quick overview of how to use a class/function. This is what I get: In [8]: time