summaryrefslogtreecommitdiff
path: root/numpy/array_api/_set_functions.py
diff options
context:
space:
mode:
authorwarren <warren.weckesser@gmail.com>2021-10-01 23:11:58 -0400
committerwarren <warren.weckesser@gmail.com>2021-10-01 23:39:12 -0400
commit8196c2a46fb621580a53ad5f7b2bd08cd154e870 (patch)
tree8ad132eff44a35f2e63a4c322b1eb362e9451c36 /numpy/array_api/_set_functions.py
parent6ad932c41281a6b7e525aba8a1057c09065251fa (diff)
downloadnumpy-8196c2a46fb621580a53ad5f7b2bd08cd154e870.tar.gz
ENH: core: More informative error message for broadcast(*args)
When broadcast(*args) fails because of a shape mismatch, include in the error message which arguments caused the mismatch and what their shapes are. For example, instead of >>> np.broadcast([[0, 0, 0]], [[1], [1]], [2, 2]) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: shape mismatch: objects cannot be broadcast to a single shape we now get >>> np.broadcast([[0, 0, 0]], [[1], [1]], [2, 2]) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: shape mismatch: objects cannot be broadcast to a single shape. Mismatch is between arg 0 with shape (1, 3) and arg 2 with shape (2,). This also affects broadcast_arrays() and broadcast_shapes(). Closes gh-8345.
Diffstat (limited to 'numpy/array_api/_set_functions.py')
0 files changed, 0 insertions, 0 deletions