typing.Annotated: Add Metadata to Your Typehint

typing.Annotated: Add Metadata to Your Typehint

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.

Search

Related Posts

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran