On this page
annotationlib.annotations_to_string
Up: annotationlib | Next: annotationlib.call_annotate_function
Rel: annotationlib.call_annotate_function, annotationlib.call_evaluate_function, annotationlib.Format, annotationlib.ForwardRef
Ref: docs.python.org — annotationlib.annotations_to_string
Tags: #public #python3 #stdlib #annotationlib
Import
import annotationlib
from annotationlib import annotations_to_string
Signature & Overview
annotationlib.annotations_to_string(annotations)
Convert an annotation dict containing values to approximately the STRING format.
Usage
import annotationlib
out = annotationlib.annotations_to_string({"x": int, "return": str})
assert out == {"x": "int", "return": "str"}
Gotchas
- Requires Python 3.14+: Converts a dict of evaluated annotation objects into readable string representations.
REPL Inspect
from annotationlib import annotations_to_string
help(annotations_to_string)
Linked from
- tuts/python3/stdlib_module/annotationlib
- tuts/python3/stdlib_module/annotationlib/call_annotate_function
- tuts/python3/stdlib_module/annotationlib/call_evaluate_function
- tuts/python3/stdlib_module/annotationlib/Format
- tuts/python3/stdlib_module/annotationlib/ForwardRef
- tuts/python3/stdlib_module/annotationlib/get_annotate_from_class_namespace
- tuts/python3/stdlib_module/annotationlib/get_annotations
- tuts/python3/stdlib_module/annotationlib/type_repr
Related notes
- tuts/python3/stdlib_module/annotationlib/call_annotate_function Linked here; links to this page; shared tags: #annotationlib, #stdlib
- tuts/python3/stdlib_module/annotationlib/call_evaluate_function Linked here; links to this page; shared tags: #annotationlib, #stdlib
- tuts/python3/stdlib_module/annotationlib/Format Linked here; links to this page; shared tags: #annotationlib, #stdlib
- tuts/python3/stdlib_module/annotationlib/ForwardRef Linked here; links to this page; shared tags: #annotationlib, #stdlib
- tuts/python3/stdlib_module/annotationlib Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/annotationlib/get_annotate_from_class_namespace links to this page; shared tags: #annotationlib, #stdlib
- tuts/python3/stdlib_module/annotationlib/get_annotations links to this page; shared tags: #annotationlib, #stdlib
- tuts/python3/stdlib_module/annotationlib/type_repr links to this page; shared tags: #annotationlib, #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib