-
Notifications
You must be signed in to change notification settings - Fork 44
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
explicitly check for Python scalars in constant tests #15
Conversation
I don't think this is a good idea, see data-apis/array-api#154 (comment).
The same applies to shape tuples, e.g. TensorFlow has a custom |
data-apis/array-api#169 clarified
So for the current spec duck typing is not allowed and the tests proposed by me should happen. We could switch the the check to I'm fine with allowing other objects if there is a precise definition of what interfaces the object needs to provide to be considered compliant. IMO
is too vague for that. |
Yes, we should fix that wording. |
This looks good, assuming we clarify whether it should be float or Number. You can ignore GitHub actions. |
Something to keep in mind is, in their current state, the |
Not my fight, but I eventually settled on this approach for numerical duck-type static and runtime checking using ☝️ That approach is a little convoluted, but I'm happy to shed more light, if helpful or desired. In short, most of that file is setting the stage for its Again, I'm happy to talk shop if my technique proves useful outside my narrow corner of the Pythonverse. |
I don't know if you saw, but I pulled out a lot of my number typing work-arounds into their own package called |
@posita I saw this before, awesome project! I'll at some point explore using it in a branch, and from there we can see if 1) it really can cover all the bases 2) we're happy to add the dependency. |
If you have any questions or encounter any friction or gaps, please don't hesitate to reach out. I'm eager to make sure this is useful and accessible to others, and happy to help out where I can. |
Closed in favour of #52, as some of the array module usage was unnecessary after data-apis/array-api#169 (and so added unwanted dependencies). Whilst the docs say constants are "Python floats i.e. Thanks @pmeier for this PR, as the introduced nan and inf test logic was useful. (@posita so yeah for this we probably don't want |
Fixes #14.