Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: is_lazy_array and is_writeable_array to return False on non-arrays #237

Merged
merged 1 commit into from
Jan 17, 2025

Conversation

crusaderky
Copy link
Contributor

@crusaderky crusaderky commented Jan 17, 2025

Change is_lazy_array and is_writeable_array to return False when the argument is not an array API object at all.
This puts them in line with all other is_*_array functions and is coherent with isinstance semantics.

Clarify in the documentation that all is_*_array objects accept any object as parameter.

Out of scope: annotate with TypeIs, which is very much non-trivial.

assert __name__.endswith('.common._helpers')
return __name__.removesuffix('.common._helpers')


def is_numpy_namespace(xp) -> bool:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sphinx gave me grief over ModuleType, so I left it out of scope for this PR.

@ev-br ev-br merged commit 44e1eb3 into data-apis:main Jan 17, 2025
42 checks passed
@ev-br
Copy link
Contributor

ev-br commented Jan 17, 2025

LGTM, thanks @crusaderky

@crusaderky crusaderky deleted the is_array_object branch January 20, 2025 00:01
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.

2 participants