PyDocs

Nav

Python Runtime Services

BoundArguments.apply_defaults

inspect

method of BoundArguments · Added in 3.5 (source)
  • BoundArguments.apply_defaults()
Set default values for missing arguments.

For variable-positional arguments (*args) the default is an
empty tuple.

For variable-keyword arguments (**kwargs) the default is an
empty dict.
1 Example
>>> def foo(a, b='ham', *args): pass
>>> ba = inspect.signature(foo).bind('spam')
>>> ba.apply_defaults()
>>> ba.arguments
{'a': 'spam', 'b': 'ham', 'args': ()}
from the Python docs
See Also
No see-alsos for inspect/BoundArguments.apply_defaults
0 Notes
No notes for BoundArguments.apply_defaults