diff options
author | Aaron Meurer <asmeurer@gmail.com> | 2022-03-28 16:12:47 -0600 |
---|---|---|
committer | Aaron Meurer <asmeurer@gmail.com> | 2022-03-28 16:12:47 -0600 |
commit | 7ed0189477ed4a7d2907d0728b3b8121722d8a2f (patch) | |
tree | e70095408b371e7a81ffe0eced36fffd59aaa778 /numpy/array_api/_array_object.py | |
parent | 71e7620711d6ff8cb838bdffb5e91cdd25497dba (diff) | |
download | numpy-7ed0189477ed4a7d2907d0728b3b8121722d8a2f.tar.gz |
Update some Note comments in numpy.array_api
Diffstat (limited to 'numpy/array_api/_array_object.py')
-rw-r--r-- | numpy/array_api/_array_object.py | 5 |
1 files changed, 5 insertions, 0 deletions
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 |