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 tonylownds
Recipients
Date 2007-01-06.21:03:32
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
I tried to implement getargspec() as described, and unfortunately there 
is another wrinkle to consider. Keyword-only arguments may or may not 
have defaults. So the invariant described in getargspec()'s docstring can't 
be maintained when simply appending keyword-only arguments.

    A tuple of four things is returned: (args, varargs, varkw, defaults).
    'args' is a list of the argument names (it may contain nested lists).
    'args' will include keyword-only argument names. 
    'varargs' and 'varkw' are the names of the * and ** arguments or None.
    'defaults' is an n-tuple of the default values of the last n arguments.

The attached patch adds an 'getfullargspec' API that returns complete 
information; 'getargspec' raises an error if information would be lost; the order 
of arguments in 'formatargspec' is backwards compatible, so that
formatargspec(*getargspec(f)) == formatargspec(*getfullargspec(f)) when
getargspec(f) does not raise an error.

PEP 362 could and probably should replace the new getfullargspec() function,
so I did not implement an API more complicated than a tuple.

File Added: pydoc.patch
History
Date User Action Args
2007-08-23 15:55:34adminlinkissue1607548 messages
2007-08-23 15:55:34admincreate