Skip to content

Conversation

@paddyroddy
Copy link
Member

@paddyroddy paddyroddy commented Jan 29, 2026

Description

The Array API spec doesn't have a definition of len(). This PR changes .size references to .shape[0]. It also changes some current len() to .shape[0].

Closes: #998

Checks

  • Is your code passing linting?
  • Is your code passing tests?
  • Have you added additional tests (if required)?
  • Have you modified/extended the documentation (if required)?
  • Have you added a one-liner changelog entry above (if required)?

@paddyroddy paddyroddy self-assigned this Jan 29, 2026
@paddyroddy paddyroddy added maintenance Maintenance: refactoring, typos, etc. array-api Work is related to the Array API labels Jan 29, 2026
@paddyroddy paddyroddy changed the title gh-988: Change all references to len to .shape[0] gh-998: Change all references to len to .shape[0] Jan 29, 2026
@paddyroddy paddyroddy requested a review from connoraird January 29, 2026 16:41
Copy link
Contributor

@connoraird connoraird left a comment

Choose a reason for hiding this comment

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

I assume that the instances of size which are now shape[0] used to be len or are being applied to a cl?

@paddyroddy
Copy link
Member Author

I assume that the instances of size which are now shape[0] used to be len or are being applied to a cl?

See 6a12b05

@connoraird
Copy link
Contributor

See 6a12b05

So are we not sure if they used to be len before they were converted to size?

@paddyroddy
Copy link
Member Author

So are we not sure if they used to be len before they were converted to size?

I wasn't clear what you were asking. I guess not.

@connoraird
Copy link
Contributor

I wasn't clear what you were asking. I guess not.

If we trust our tests then this is okay

@paddyroddy
Copy link
Member Author

If we trust our tests then this is okay

I probably don't... Will check tomorrow.

@paddyroddy
Copy link
Member Author

I probably don't... Will check tomorrow.

I've been more cautious and reverted all of them unless cl or in tests.

@paddyroddy paddyroddy merged commit 77e4390 into main Jan 29, 2026
13 of 14 checks passed
@paddyroddy paddyroddy deleted the padd/issue-998 branch January 29, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

array-api Work is related to the Array API maintenance Maintenance: refactoring, typos, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decide on how we emulate len(x) in the array api

3 participants