Typing and Generics

typing.Any

Allows a dynamically typed value to participate in operations without the usual static restrictions. Unlike object, it permits unchecked operations; prefer a precise type when possible.

Formal Syntax & Structure

python syntaxpython
typing.Any

Return Value

Any

Typing construct or runtime result as described; static typing rules are not runtime validation.

Working Example

Example Snippetpython
from typing import Any
def label(value: Any) -> str: return str(value)print((label(7), label('ok')))
Python Reference