`numpy.__array_namespace_info__().dtypes()["float64"] == None` is `True` but `numpy.float64 == None` is `False`
In my understanding, dtype can be any Python object in array API specification, and therefore may be None depending on the library. If the device is somewhat set to None while using numpy backend in array API compatible code, the above specification (https://github.com/numpy/numpy/issues/18434) causes various problems when working with dtypes.
> from array_api_compat import numpy as np
> np.__array_namespace_info__().dtypes()["float64"]
dtype('float64')
> np.float64
<class 'numpy.float64'>
> np.__array_namespace_info__().dtypes()["float64"] == np.float64
True
> np.__array_namespace_info__().dtypes()["float64"] == None
True
> np.float64 == None
False
This is just caused by an oddity in NumPy and it'd be best to fix it there.
It could be avoided by returning np.float64 instead of np.dtype('float64') here:
https://github.com/data-apis/array-api-compat/blob/35d333af3b7e718e2a147400db0b16a874ea42da/array_api_compat/numpy/_info.py#L272
That would seem to be the most natural choice, not sure why it was implemented like this. Changing it now might give some issues for someone in corner cases though, just like this issue is just a corner case. So I don't know if anything should be done here - "just don't do that" is also a fine answer.
https://github.com/data-apis/array-api-compat/blob/35d333af3b7e718e2a147400db0b16a874ea42da/array_api_compat/numpy/_info.py#L247-L252
I just noticed that this doctest is inconsistent with the current behavior (dtype('int8'). ...) by the way