Comment Comment by pseudonom- > (Do bear or typeguard allow you to do this using decorators?)You can push some of this directly into Python type annotations thanks to https://peps.python.org/pep-0646/.e.g. @overload def mean(a: ndarray[float, Dim1, *Shape], axis: Literal[0]) -> ndarray[float, *Shape]: ... @overload def mean(a: ndarray[float, Dim1, Dim2, *Shape], axis: Literal[1]) -> ndarray[float, Dim1, *Shape]: ... parent pseudonom- 3 years ago
You can push some of this directly into Python type annotations thanks to https://peps.python.org/pep-0646/.
e.g.