Closed as not planned
Description
While it looks deliberate, still feels a bit too strict:
In [6]: import array_api_strict as xp
In [7]: a = xp.arange(3)
In [8]: a / 2
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[8], line 1
----> 1 a / 2
File ~/miniforge3/envs/scipy-dev/lib/python3.12/site-packages/array_api_strict/_array_object.py:801, in Array.__truediv__(self, other)
797 def __truediv__(self: Array, other: Union[float, Array], /) -> Array:
798 """
799 Performs the operation __truediv__.
800 """
--> 801 other = self._check_allowed_dtypes(other, "floating-point", "__truediv__")
802 if other is NotImplemented:
803 return other
File ~/miniforge3/envs/scipy-dev/lib/python3.12/site-packages/array_api_strict/_array_object.py:164, in Array._check_allowed_dtypes(self, other, dtype_category, op)
153 """
154 Helper function for operators to only allow specific input dtypes
155
(...)
160 return other
161 """
163 if self.dtype not in _dtype_categories[dtype_category]:
--> 164 raise TypeError(f"Only {dtype_category} dtypes are allowed in {op}")
165 if isinstance(other, (int, complex, float, bool)):
166 other = self._promote_scalar(other)
TypeError: Only floating-point dtypes are allowed in __truediv__
Metadata
Metadata
Assignees
Labels
No labels