[Python-Dev] PEP 362 Third Revision (original) (raw)

Yury Selivanov yselivanov.ml at gmail.com
Thu Jun 14 20:09:36 CEST 2012


On 2012-06-14, at 1:51 PM, Terry Reedy wrote:

On 6/14/2012 6:00 AM, Nick Coghlan wrote:

> Just a thought: Do we want to include the docstring? A function's > docstring is often intimately tied to its signature. (Or at least, a > lot of us try to write docstrings that effectively describe the > function's signature)

No, combining the signature with other details like the name and docstring is the task of higher level interfaces like pydoc. Idle tooltips are potentially two lines: the signature and the first line of the docstring. (Some builtins need a better first line, but thats another issue.)

We've decided to make Signature to represent only call-signature-part of objects. Docstring, along with object's name and docstring isn't part of it.

In any way, it's easy to get all information you need:

def introspect_function(func):
    sig = signature(func)
    return (func.__name__, func.__doc__, str(sig))


More information about the Python-Dev mailing list