Skip to content

Conversation

@asmeurer
Copy link
Member

@asmeurer asmeurer commented Jul 1, 2024

upstream code (see scipy/scipy#21074). The standard does not define iteration, but it does define __getitem__, and the default Python __iter__ implements iteration when getitem is defined as a[0], a[1], ..., implying that iteration ought to work for 1-D arrays. Iteration is still disallowed for higher dimensional arrays, since getitem would not necessarily work with a single integer index (and this is the case that is controversial). In those cases, the new unstack() function would be preferable.

At best it would be good to get upstream clarification from the standard whether iteration should always work or not before disallowing 1-D array iteration.

upstream code (see scipy/scipy#21074). The standard does not define iteration,
but it does define __getitem__, and the default Python __iter__ implements
iteration when getitem is defined as a[0], a[1], ..., implying that iteration
ought to work for 1-D arrays. Iteration is still disallowed for higher
dimensional arrays, since getitem would not necessarily work with a single
integer index (and this is the case that is controversial). In those cases,
the new unstack() function would be preferable.

At best it would be good to get upstream clarification from the standard
whether iteration should always work or not before disallowing 1-D array
iteration.
@asmeurer asmeurer enabled auto-merge July 1, 2024 19:33
@asmeurer asmeurer temporarily deployed to publish-package July 1, 2024 19:34 — with Image GitHub Actions Inactive
@asmeurer asmeurer merged commit 6b0079b into data-apis:main Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant