Skip to content

Commit 06e78f9

Browse files
committed
scalars in binary functions
1. Generate all binary "ufuncs" in a uniform way, with a decorator 2. Make binary "ufuncs" follow the same logic of the binary operators 3. Reuse the test loop of Array.__binop__ for binary "ufuncs" 4. (minor) in tests, reuse canonical names for dtype categories ("integer or boolean" vs "integer_or_boolean")
1 parent 4b101b6 commit 06e78f9

5 files changed

+223
-577
lines changed

array_api_strict/_array_object.py

+2
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,8 @@ def _check_device(self, other):
234234
elif isinstance(other, Array):
235235
if self.device != other.device:
236236
raise ValueError(f"Arrays from two different devices ({self.device} and {other.device}) can not be combined.")
237+
else:
238+
raise TypeError(f"Cannot combine an Array with {type(other)}.")
237239

238240
# Helper function to match the type promotion rules in the spec
239241
def _promote_scalar(self, scalar):

0 commit comments

Comments
 (0)