[Numpy-discussion] somewhat less stupid problem with 0-d arrays

Neal Becker ndbecker2 at gmail.com
Fri May 10 19:57:21 EDT 2013


It would be convenient if in arithmetic 0-d arrays were just ignored - it would
seem to me to be convenient in generic code where a degenerate array is treated
as "nothing"

np.zeros ((0,0)) + np.ones ((2,2))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-17-27af0e0bbc6f> in <module>()
----> 1 np.zeros ((0,0)) + np.ones ((2,2))

ValueError: operands could not be broadcast together with shapes (0,0) (2,2)






More information about the NumPy-Discussion mailing list