If you want to add metadata to your typehint such as units of measurement, use typing.Annotated
.
Annotated[T, x]
allows static typechecking such as mypy to check T
while safely ignoring x
.
This method is available for Python 3.9 and above.
If you want to add metadata to your typehint such as units of measurement, use typing.Annotated
.
Annotated[T, x]
allows static typechecking such as mypy to check T
while safely ignoring x
.
This method is available for Python 3.9 and above.