improve `ndarray.__getitem__` with rank-typing
@jorenham is already working on this.
Since May 15, 2025.
Assessment
This issue has not been assessed yet.
Description
It's a very complicated method signature, e.g.
_[()]returnsSelfif 1d+, otherwise (if 0d) returns its scalar type_[int]returnsSelf[DTypeT, ShapeT[1:]]if 1d+, otherwise (if 0d) returns its scalar type_[int, int]returnsSelf[DTypeT, ShapeT[1:]]if 1d+, otherwise (if 0d) returns its scalar type- ...
_[None]returnsarray[DTypeT, (int, *ShapeT)]_[None, None]returnsarray[DTypeT, (int, int, *ShapeT)]- ...
_[slice | array-indexer]returnsSelffor 1d+, otherwise rejects_[slice | array-indexer, slice | array-indexer]returnsSelffor 2d+, otherwise rejects- ...
_[...]returnsSelffor 0d+
almost all possible combinations are also valid 😅
- Dominant language
- Python
- Stars
- 79
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from numpy/numtype
-
topic: documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
topic: documentation
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
blame: Pyright tool: basedpyright
-
numpy.generic stubs: Incomplete
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
_numtype stubs: Refactor
Difficulty 3/5 1-2 days Newbie friendliness 45/100
Similar issues
-
essnmx good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
[Feature] 奇物选择添加优先级 Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
syfoud/Simulated_Scepter#174 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Giskard-AI/giskard-oss#2840 · 1 comment ·
-
A claim comment carrying the issue number is silently declined while the workflow reports success Openarea: repo bug perceived difficulty: 2
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
yeti-platform/yeti#1380 ·