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 mdk
Recipients larry, martin.panter, mdk, rhettinger, serhiy.storchaka, vstinner
Date 2016-11-28.14:22:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480342937.59.0.572853150733.issue28754@psf.upfronthosting.co.za>
In-reply-to
Content
Hi Raymond,

About Argument Clinic
#####################

Just to clarify the situation, Argument Clinic allows for clear method signature, typically: `hi: Py_ssize_t(py_default="len(a)") = -1` gives the expected "hi=len(a)" signature successfully.

The problem is that it's not a legal signature (it's a syntax error), so pydoc crashes while parsing it (search for RuntimeError in the history of the issue for a full stacktrace).

About what should we put in the signature
#########################################

Question is: Should we allow "semantically precise, but frustrating*" signatures to be documented or should we be move the semantic away from the signature?

*: I mean, is a new user sees "hi=len(a)" in a signature in a docstring he will immediately flag this syntax as valid and usable later, which lead him to a syntax error and some frustration.

Something else to keep in mind is that I expect users be able to call those methods indirectly, like:

def whatever_they_need(self, lo=0, hi=?):
    …
    bisect.bisect(…, …, lo, hi)
    …

Currently, to follow strictly the documentation they have to write:

def whatever_they_need(self, lo=0, hi=None):
    …
    if hi is not None:
        bisect.bisect(…, …, lo, hi)
    else:
        bisect.bisect(…, …, lo)
    …

Which looks bad to me. So from my point of view we *have to* tell them what is the real default value for this parameter so they can use it in their implementations.

Should we generalize and say that depending on the number of arguments is a bad practice? I think so.
History
Date User Action Args
2016-11-28 14:22:17mdksetrecipients: + mdk, rhettinger, vstinner, larry, martin.panter, serhiy.storchaka
2016-11-28 14:22:17mdksetmessageid: <1480342937.59.0.572853150733.issue28754@psf.upfronthosting.co.za>
2016-11-28 14:22:17mdklinkissue28754 messages
2016-11-28 14:22:17mdkcreate