On this page
inspect.getcallargs
Prev: inspect.getblock | Up: inspect | Next: inspect.getclasstree
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.getcallargs
Tags: #public #python3 #stdlib #inspect
Import
import inspect
from inspect import getcallargs
Signature & Overview
inspect.getcallargs(func, /, *positional, **named)
Get the mapping of arguments to values.
Usage
import inspect
def fn(a, b=2): pass
assert inspect.getcallargs(fn, 1) == {"a": 1, "b": 2}
Gotchas
- Deprecated in favor of
inspect.signature(fn).bind(...):BoundArgumentshandles positional-only params and defaults more cleanly.
REPL Inspect
from inspect import getcallargs
help(getcallargs)
Linked from
Related notes
- tuts/python3/stdlib_module/inspect/getblock Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/getclasstree Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/inspect/ArgInfo Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Arguments Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/Attribute Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BlockFinder Linked here; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BoundArguments shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/BufferFlags shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/ClassFoundException shared tags: #inspect, #stdlib