PyDocs

Nav

Python Runtime Services

getfullargspec

inspect

function (source)
  • getfullargspec(func, *, annotation_format=Format.VALUE)
Get the names and default values of a callable object's parameters.

A FullArgSpec namedtuple is returned, which has the following attributes:
'args' is a list of the parameter names.
'varargs' and 'varkw' are the names of the * and ** parameters or None.
'defaults' is an n-tuple of the default values of the last n parameters.
'kwonlyargs' is a list of keyword-only parameter names.
'kwonlydefaults' is a dictionary mapping names from kwonlyargs to defaults.
'annotations' is a dictionary mapping parameter names to annotations.

The *annotation_format* parameter controls the format of the annotations.
See the annotationlib documentation for details.

Notable differences from inspect.signature():
  - the "self" parameter is always reported, even for bound methods
  - wrapper chains defined by __wrapped__ *not* unwrapped automatically
Changed in 3.4, 3.6, 3.7, 3.15
  • 3.4: This function is now based on signature(), but still ignores __wrapped__ attributes and includes the already bound first parameter in the signature output for bound methods.
  • 3.6: This method was previously documented as deprecated in favour of signature() in Python 3.5, but that decision has been reversed in order to restore a clearly supported standard interface for single-source Python 2/3 code migrating away from the legacy getargspec() API.
  • 3.7: Python only explicitly guaranteed that it preserved the declaration order of keyword-only parameters as of version 3.7, although in practice this order had always been preserved in Python 3.
  • 3.15: The annotation_format parameter was added.
0 Examples
No examples for inspect/getfullargspec.
See Also
No see-alsos for inspect/getfullargspec
0 Notes
No notes for getfullargspec