On this page
inspect.getargs
Prev: inspect.getabsfile | Up: inspect | Next: inspect.getargvalues
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.getargs
Tags: #public #python3 #stdlib #inspect
Import
import inspect
from inspect import getargs
Signature & Overview
inspect.getargs(co)
Get information about the arguments accepted by a code object.
Usage
import inspect
def fn(a, b, *rest, **kw): pass
args = inspect.getargs(fn.__code__)
assert args.args == ["a", "b"] and args.varargs == "rest" and args.varkw == "kw"
Gotchas
- Takes a
codeobject, not a function: Preferinspect.signature(fn)for general introspection.
REPL Inspect
from inspect import getargs
help(getargs)
Linked from
Related notes
- tuts/python3/stdlib_module/inspect/getabsfile Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/getargvalues 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