With array-api-compat 1.8, NumPy 2.0.1
In [22]: array_namespace(np.asarray(0.0), use_compat=None)
Out[22]: <module 'numpy' from '/Users/lucascolley/mambaforge/envs/scipy-dev/lib/python3.10/site-packages/numpy/__init__.py'>
In [23]: array_namespace(np.float64(0.0), use_compat=None)
Out[23]: <module 'scipy._lib.array_api_compat.numpy' from '/Users/lucascolley/programming/scipy/build-install/lib/python3.10/site-packages/scipy/_lib/array_api_compat/numpy/__init__.py'>
This behaviour is quite problematic for SciPy given NumPy's tendency to throw NumPy scalars at you under very little pressure.
In [25]: array_namespace(np.asarray(0.0) - 32, use_compat=None)
Out[25]: <module 'scipy._lib.array_api_compat.numpy' from '/Users/lucascolley/programming/scipy/build-install/lib/python3.10/site-packages/scipy/_lib/array_api_compat/numpy/__init__.py'>
It seems practical to have NumPy scalars return the same namespace as NumPy arrays when use_compat=None. Or perhaps a different argument should have to be passed to use_compat (that would be fine for us).
With array-api-compat 1.8, NumPy 2.0.1
This behaviour is quite problematic for SciPy given NumPy's tendency to throw NumPy scalars at you under very little pressure.
It seems practical to have NumPy scalars return the same namespace as NumPy arrays when
use_compat=None. Or perhaps a different argument should have to be passed touse_compat(that would be fine for us).