On this page
  1. inspect.formatannotation
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

inspect.formatannotation

Prev: inspect.findsource | Up: inspect | Next: inspect.formatannotationrelativeto
Rel: inspect.ArgInfo, inspect.Arguments, inspect.Attribute, inspect.BlockFinder
Ref: docs.python.org — inspect.formatannotation
Tags: #public #python3 #stdlib #inspect


Import

import inspect
from inspect import formatannotation

Signature & Overview

inspect.formatannotation(annotation, base_module=None, *, quote_annotation_strings=True)

inspect.formatannotation() function.

Usage

import inspect

assert inspect.formatannotation(int) == "int"
assert inspect.formatannotation("MyType") == "'MyType'"

Gotchas

REPL Inspect

from inspect import formatannotation
help(formatannotation)

Linked from

Related notes