Skip to content

add optype.numpy.CanArray0#454

Merged
jorenham merged 1 commit into
masterfrom
CanArray0
Oct 1, 2025
Merged

add optype.numpy.CanArray0#454
jorenham merged 1 commit into
masterfrom
CanArray0

Conversation

@jorenham

@jorenham jorenham commented Oct 1, 2025

Copy link
Copy Markdown
Owner

This adds a CanArray0 protocol to optype.numpy. It's (like its name) very similar to CanArray0D, but doesn't require a __len__ method. This causes it to also accept "bare" numpy scalars like np.int_(42).
It can be used to simplify SCT | onp.CanArray0D[SCT] as onp.CanArray0[SCT], for example:
https://github.com/scipy/scipy-stubs/blob/893edb843f434871906c714b79742d027740011f/scipy-stubs/linalg/_special_matrices.pyi#L46

Closes #398 (albeit in in a different, backwards-compatbile, way)

@jorenham jorenham added this to the v0.14.0 milestone Oct 1, 2025
@jorenham jorenham merged commit 5d851c3 into master Oct 1, 2025
19 checks passed
@jorenham jorenham deleted the CanArray0 branch October 1, 2025 02:07
Sign up for free to 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.

rename CanArray0D to CanArrayStrict0D and add CanArray0D that has no __len__

1 participant