You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 10, 2020. It is now read-only.
The typing_extensions module contains backports of new typing features for earlier versions of Python. It is understood by type checkers like Mypy and Pyre. In #59 it is proposed that we add it as a dependency, which I think is a good idea. Beyond just that PR, some potential benefits are:
Using Literal to better type specific (but fairly common) overloads, e.g.
np.array(..., dtype="float")
Protocol might be a good way to approach typing ArrayLike
Using TypedDict to better describe complex dtypes.
I imagine that the biggest concern would be forcing it to be a hard dependency of NumPy should the stubs be moved there, but I believe we can avoid that.
If everything stays stubs only, then it's not a problem
If we do add annotations to source files, we can still work around it with constructs like
fromtypingimportTYPE_CHECKINGifTYPE_CHECKING:
fromtyping_extensionsimportLiteralx: 'Literal[1]'=1# Or use `from __future__ import annotations` post 3.8
...
Objections? In the absence of them we'll move forward with including it.