Skip to content
This repository was archived by the owner on Feb 17, 2021. It is now read-only.

Commit 378db00

Browse files
committed
Make NestedList admit sequences.
numpy will actually accept not just lists, but also tuples as array-like.
1 parent 3e37ef2 commit 378db00

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

numpy-stubs/__init__.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ _FloatObj = TypeVar("_FloatObj", bound=Union[floating, float])
6868
_Int = TypeVar("_Int", bool_, int8, int16, int32, int64)
6969
_IntObj = TypeVar("_IntObj", bound=Union[integer, int])
7070

71-
_NestedList = Union[List[_T], List[List[_T]], List[List[List[_T]]], List[List[List[List[_T]]]]]
71+
_NLT = TypeVar("_NLT", covariant=True)
72+
_NestedList = Union[
73+
Sequence[_NLT],
74+
Sequence[Sequence[_NLT]],
75+
Sequence[Sequence[Sequence[_NLT]]],
76+
Sequence[Sequence[Sequence[Sequence[_NLT]]]],
77+
]
7278

7379
class ndarray(Generic[_DType]):
7480
"""

0 commit comments

Comments
 (0)