diff options
author | Aaron Meurer <asmeurer@gmail.com> | 2021-07-21 15:48:06 -0600 |
---|---|---|
committer | Aaron Meurer <asmeurer@gmail.com> | 2021-07-21 15:48:06 -0600 |
commit | 63a9a87360ef492c46c37416b8270563e73a6349 (patch) | |
tree | 7d04d62253f2402d589803539d98875c60222fbc /numpy/array_api/_creation_functions.py | |
parent | 9d5d0ec2264c86a19714cf185a5a183df14cbb94 (diff) | |
download | numpy-63a9a87360ef492c46c37416b8270563e73a6349.tar.gz |
Restrict the array API namespace array operator type promotions
Only those type promotions that are required by the spec are allowed. In
particular, promotions across kinds, like integer + floating-point, are not
allowed, except for the case of Python scalars.
Tests are added for this.
This commit additionally makes the operators return NotImplemented on
unexpected input types rather than directly giving a TypeError. This is not
strictly required by the array API spec, but it is generally considered a best
practice for operator methods in Python.
This same thing will be implemented for the various functions in the array API
namespace in a later commit.
Diffstat (limited to 'numpy/array_api/_creation_functions.py')
0 files changed, 0 insertions, 0 deletions