A typical pain point where type hinting fails in Python is with list of some types, it can't be enforced by the language without more checks.
For example, you can't do:
if isinstance(x, list[int])
though it would be super useful
For example, you can't do:
if isinstance(x, list[int])
though it would be super useful
els: List[int]
To test it at runtime you can use typeguard s @typechecked annotation. For convenience you can also use Pydantic.How do you do this in Pydantic though?
It can also be used to generate openapi swagger files from the types and things like that.