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

isdtype() should raise if parameter is not a dtype #117

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

crusaderky
Copy link
Contributor

@crusaderky crusaderky commented Jan 2, 2025

Raise on a typical mistake made by a user that didn't properly read the API documentation (i.e. me):

>>> xp.isdtype(xp.asarray(1.0), xp.float64))
False

Copy link
Contributor

@ev-br ev-br left a comment

Choose a reason for hiding this comment

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

There's room to argue that if something is not a dtype, isdtype(something, kind) should just return False, because... something is not a kind of a dtype. That would be pythonic etc, but since this project aims to be strict, the change makes sense.

LGTM, thanks @crusaderky

@ev-br ev-br merged commit 17c17f5 into data-apis:main Jan 7, 2025
21 checks passed
@crusaderky crusaderky deleted the isdtype branch January 7, 2025 14:03
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