How should I type-hint a numpy ndarray which can be of any integer type? My thoughts are:
from numpy.typing import DTypeLike, NDArray
# option (1)
arr: NDArray[+(np.int8, np.int16, np.int32, np.int64)]
# option (2)
ScalarIntType: tuple[DTypeLike, ...] = (np.int8, np.int16, np.int32, np.int64)
arr: NDArray[+ScalarIntType]
# option (3)
arr: NDArray[np.int8] | NDArray[np.int16] | NDArray[np.int32] | NDArray[np.int64]
Is one of those options valid and/or which one would be best and/or which alternatives do I have?
Thanks,
Mathieu