4 ms·
This happens in numpy as well, and was confusing the first time I saw it: b = np.ones(1) c = np.ones(1) c = c/(2**73) b += c >>> ufunc 'a
by tcpekin 5y ago
This happens in numpy as well, and was confusing the first time I saw it:
b = np.ones(1)
c = np.ones(1)
c = c/(2**73)
b += c
>>> ufunc 'add' output (typecode 'O') could not be coerced to provided output parameter (typecode 'd') according to the casting rule ''same_kind''
but `b = b + c` does work.
[1] https://stackoverflow.com/questions/12588986/typeerror-generated-when-using-inplace-operations-on-numpy-arrays https://stackoverflow.com/questions/12588986/typeerror-gener...