On this page
inspect.formatannotationrelativeto
Prev: inspect.formatannotation | Up: inspect | Next: inspect.formatargvalues
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.formatannotationrelativeto
Tags: #public #python3 #stdlib #inspect
Import
import inspect
from inspect import formatannotationrelativeto
Signature & Overview
inspect.formatannotationrelativeto(object)
inspect.formatannotationrelativeto() function.
Usage
import inspect
formatter = inspect.formatannotationrelativeto(inspect)
assert callable(formatter) and formatter(int) == "int"
Gotchas
- Returns a callable formatter that shortens annotations defined in the same module as the given object.
REPL Inspect
from inspect import formatannotationrelativeto
help(formatannotationrelativeto)
Linked from
Related notes
- tuts/python3/stdlib_module/inspect/formatannotation Linked here; links to this page; shared tags: #inspect, #stdlib
- tuts/python3/stdlib_module/inspect/formatargvalues 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