Check type hints
Closed this issue · 0 comments
suzannejin commented
Python don't check the type hints at runtime. They are there simply for cleaner code.
However, there is a package that allows the checking of the declared type hints.
Example:
from typeguard import typechecked
@typechecked
def function1(sequence: str):
...
This does not improve performance like cPython does when declaring argument types.
However, it can be useful to make necessary checks to ensure our code will get the correct inputs.