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 terry.reedy
Recipients louielu, serhiy.storchaka, terry.reedy, yselivanov
Date 2017-05-04.19:44:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1493927075.15.0.0437482593521.issue19903@psf.upfronthosting.co.za>
In-reply-to
Content
Let's back up.  The high-level specification for get_argspec is something like 'Return information that will help programmers write a correct call."  The proposed implementation strategy is to combine signature info from signature (replacing getfullargspec) and the initial part of the callable docstring.

This goal and strategy mimic help(callable).  So we can use its output as a guide, but improve on it when we can and think we should.  This issue could be framed as 'catch up with help(callable)' which already switched to signature.

The test examples constitute a low-level specification by example.  As such, they should be discussed here before changing the code. Let's consider the ones you listed, using 'help(callable)' as a guide.

>>> help(range.__init__)
Help on wrapper_descriptor:
__init__(self, /, *args, **kwargs)
    Initialize self.  See help(type(self)) for accurate signature.

Not very helpful, but if one types 'range.__init__(', one currently sees the last line and should see the last two lines in the future.

However, the calltip for 'range(' should not be the above.  When type(__init__).__name__ == 'wrapper_descripter, the "fob = ob.__init__" replacement should not happen, at least not until we see a case where a wrapper_descripter has the real signature.  (Whether is it still needed for python-coded classes is a separate issue.)  I don't know if all built-in inits 

>>> help(list.append)
Help on method_descriptor:
append(self, object, /)
    Append object to the end of the list.
>>> help([].append)
Help on built-in function append:
append(object, /) method of builtins.list instance
    Append object to the end of the list.

The signature output is fine with me.  I want future calltips to include it, along with the docstring line.

The only issue is the ', /'.  If people can survive it presence in help output, ditto for calltips.  But whenever a signature string contains '/', we could add, between signature and docstring lines, the following.
"('/' marks preceding arguments as positional-only.)"  If we do this, the string should be a global '_positional = ...' so it can be used as-is for tests.  I am inclined to try this.

I want to leave the '/' in the signature because there have been multiple issues and forum questions about why the equivalent of [].append(object='a') does not work.  Now, some built-in parameters are positional-only, some keyword-only, and some both.  The hint should make this clear.
History
Date User Action Args
2017-05-04 19:44:35terry.reedysetrecipients: + terry.reedy, serhiy.storchaka, yselivanov, louielu
2017-05-04 19:44:35terry.reedysetmessageid: <1493927075.15.0.0437482593521.issue19903@psf.upfronthosting.co.za>
2017-05-04 19:44:35terry.reedylinkissue19903 messages
2017-05-04 19:44:35terry.reedycreate