Skip to content

TYP: add None to __getitem__ in numpy.array_api - #25022

Merged
rgommers merged 2 commits into
numpy:mainfrom
Illviljan:array_api_typing_getitem
Nov 13, 2023
Merged

TYP: add None to __getitem__ in numpy.array_api#25022
rgommers merged 2 commits into
numpy:mainfrom
Illviljan:array_api_typing_getitem

Conversation

@Illviljan

@IllviljanIllviljan commented Oct 28, 2023

Copy link
Copy Markdown
Contributor

Add None to the getitem type hints.

The array_api site doesn't mention it in the getitem page until the draft version however:
https://data-apis.org/array-api/draft/API_specification/generated/array_api.array.__getitem__.html

But it is mentioned in the 2021.12 version in the indexing page:

Each None in the selection tuple must expand the dimensions of the resulting selection by one dimension of size 1. The position of the added dimension must be the same as the position of None in the selection tuple.
https://data-apis.org/array-api/2021.12/API_specification/indexing.html

Which of these pages takes priority?

@rgommersrgommers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was recently fixed upstream, and the discussion in data-apis/array-api#674 shows that this change can be considered a minor bug fix for earlier versions of the standard. So this is good to merge as is. Thanks @Illviljan

@rgommers
rgommers merged commit 3c853e1 into numpy:mainNov 13, 2023
@rgommersrgommers changed the title Add None to array_api __getitem__TYP: add None to __getitem__ in numpy.array_apiNov 13, 2023
@rgommersrgommers added this to the 2.0.0 release milestone Nov 13, 2023
@charrischarris added the 09 - Backport-Candidate PRs tagged should be backported label Nov 13, 2023
charris pushed a commit to charris/numpy that referenced this pull request Nov 19, 2023
@charrischarris changed the title TYP: add None to __getitem__ in numpy.array_apiTYP: add None to __getitem__ in numpy.array_apiNov 19, 2023
@charrischarris removed the 09 - Backport-Candidate PRs tagged should be backported label Nov 19, 2023
charris pushed a commit to charris/numpy that referenced this pull request Nov 19, 2023
@TimotheusBachingerTimotheusBachinger mentioned this pull request Nov 25, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: array_api.Array has wrong type hints in __getitem__

4 participants

@Illviljan@rgommers@charris@melissawm