inspect.formatargvalues
Prev: inspect.formatannotationrelativeto | Up: inspect | Next: inspect.FrameInfo
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.formatargvalues
Tags: #public #python3 #stdlib #inspect
Import
import inspect
from inspect import formatargvalues
Signature & Overview
inspect.formatargvalues(args, varargs, varkw, locals, formatarg=<class 'str'>, formatvarargs=<function <lambda> at 0x109399850>, formatvarkw=<function <lambda> at 0x109399900>, formatvalue=<function <lambda> at 0x1093999b0>)
Format an argument spec from the 4 values returned by getargvalues.
Usage
import inspect
def demo(a, b=2):
args, varargs, varkw, locs = inspect.getargvalues(inspect.currentframe())
return inspect.formatargvalues(args, varargs, varkw, locs)
assert demo(1) == "(a=1, b=2)"
Gotchas
- Formats live frame argument values: Useful for debuggers and crash reporters.
REPL Inspect
from inspect import formatargvalues
help(formatargvalues)
Linked from
Related notes
- tuts/python3/stdlib_module/inspect/formatannotationrelativeto Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/FrameInfo 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