PyDocs

Nav

Python Runtime Services

Parameter

inspect

class (source)
  • Parameter(name, kind, *, default=Parameter.empty, annotation=Parameter.empty)
Represents a parameter in a function signature.

Has the following public attributes:

* name : str
    The name of the parameter as a string.
* default : object
    The default value for the parameter if specified.  If the
    parameter has no default value, this attribute is set to
    `Parameter.empty`.
* annotation
    The annotation for the parameter if specified.  If the
    parameter has no annotation, this attribute is set to
    `Parameter.empty`.
* kind
    Describes how argument values are bound to the parameter.
    Possible values: `Parameter.POSITIONAL_ONLY`,
    `Parameter.POSITIONAL_OR_KEYWORD`, `Parameter.VAR_POSITIONAL`,
    `Parameter.KEYWORD_ONLY`, `Parameter.VAR_KEYWORD`.
    Every value has a `description` attribute describing meaning.
Changed in 3.4, 3.5
  • 3.4: In Python 3.3 Parameter objects were allowed to have name set to None if their kind was set to POSITIONAL_ONLY. This is no longer permitted.
  • 3.5: Parameter objects are now picklable and hashable.
Members of Parameter

a

annotation
The annotation for the parameter.

d

default
The default value for the parameter.

e

empty
Marker object for Signature.empty and Parameter.empty.

k

kind
Describes how argument values are bound to the parameter.

n

name
The name of the parameter as a string.

r

replace
Creates a customized copy of the Parameter.
0 Examples
No examples for inspect/Parameter.
See Also
No see-alsos for inspect/Parameter
0 Notes
No notes for Parameter