From 7ed0189477ed4a7d2907d0728b3b8121722d8a2f Mon Sep 17 00:00:00 2001 From: Aaron Meurer Date: Mon, 28 Mar 2022 16:12:47 -0600 Subject: Update some Note comments in numpy.array_api --- numpy/array_api/_array_object.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'numpy/array_api/_array_object.py') diff --git a/numpy/array_api/_array_object.py b/numpy/array_api/_array_object.py index c86cfb3a6..6cf9ec6f3 100644 --- a/numpy/array_api/_array_object.py +++ b/numpy/array_api/_array_object.py @@ -177,6 +177,8 @@ class Array: integer that is too large to fit in a NumPy integer dtype, or TypeError when the scalar type is incompatible with the dtype of self. """ + # Note: Only Python scalar types that match the array dtype are + # allowed. if isinstance(scalar, bool): if self.dtype not in _boolean_dtypes: raise TypeError( @@ -195,6 +197,9 @@ class Array: else: raise TypeError("'scalar' must be a Python scalar") + # Note: scalars are unconditionally cast to the same dtype as the + # array. + # Note: the spec only specifies integer-dtype/int promotion # behavior for integers within the bounds of the integer dtype. # Outside of those bounds we use the default NumPy behavior (either -- cgit v1.2.1