diff options
author | Josh Wilson <person142@users.noreply.github.com> | 2020-06-11 08:42:55 -0700 |
---|---|---|
committer | Josh Wilson <person142@users.noreply.github.com> | 2020-06-11 08:42:55 -0700 |
commit | 4a120f0d073506329b564bfe9e69db2f6b612964 (patch) | |
tree | 8a1a728191d074dfd636c60a4b363969585e5a77 /numpy/typing/_array_like.py | |
parent | 70130f848b7c526862fa6ff9667f078a628d86a1 (diff) | |
download | numpy-4a120f0d073506329b564bfe9e69db2f6b612964.tar.gz |
DOC: add warning about typing-extensions module to numpy.typing docs
Typing `ArrayLike` correctly relies on `Protocol`, so warn users that
they should be on 3.8+ or install `typing-extensions` if they want
everything to work as expected.
Diffstat (limited to 'numpy/typing/_array_like.py')
-rw-r--r-- | numpy/typing/_array_like.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/typing/_array_like.py b/numpy/typing/_array_like.py index 54a612fb4..b73585cf0 100644 --- a/numpy/typing/_array_like.py +++ b/numpy/typing/_array_like.py @@ -1,5 +1,5 @@ import sys -from typing import Any, overload, Sequence, Tuple, Union +from typing import Any, overload, Sequence, TYPE_CHECKING, Union from numpy import ndarray from ._dtype_like import DtypeLike @@ -15,7 +15,7 @@ else: else: HAVE_PROTOCOL = True -if HAVE_PROTOCOL: +if TYPE_CHECKING or HAVE_PROTOCOL: class _SupportsArray(Protocol): @overload def __array__(self, __dtype: DtypeLike = ...) -> ndarray: ... |