Skip to content

typing

Supported functions in the Python standard library typing module.

Apart from the listed functions, arbitrary type hints are supported as function parameter and return type hints.

assert_never(arg: Never) -> Never

Assert that this line of code is unreachable.

assert_type(val: T, typ: Any) -> T

Ask a type checker to verify the inferred type of a value.

cast(typ: object, val: Any) -> Any

cast(typ: type[T], val: Any) -> T
cast(typ: str, val: Any) -> Any
cast(typ: object, val: Any) -> Any

Cast a value to a type.