Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Python

typing.Any

Use Any where a value has a dynamically checked type.

Version: Python 3.14; repository image, production runtime not attested

Syntax

value: Any

Use Any where a value has a dynamically checked type.

Static checking allows arbitrary operations and assignments to or from Any, whereas object requires evidence for type-specific operations. Runtime dispatch still uses the actual object.

An invalid method call therefore raises AttributeError in the example.

Examples

from typing import Any

def upper(value: Any) -> str:
    return value.upper()

print(upper("raw"))
try:
    upper(7)
except AttributeError as error:
    print(type(error).__name__)

Result

RAW
AttributeError

An invalid method call therefore raises AttributeError in the example.

Sources