Runtime Data Attributes

type.__annotations__

Class variable annotation mapping in Python 3.13. An annotation is not itself a value assignment. Prefer inspect.get_annotations for robust inspection, particularly with metaclasses.

Formal Syntax & Structure

python syntaxpython
Cls.__annotations__

Return Value

dict

Annotation mapping when available; some classes lack this attribute, and metaclasses can customize access.

Working Example

Example Snippetpython
class C:    quantity: int    label: str = 'item'print(tuple(C.__annotations__))
Python Reference