[Numpy-discussion] A Different Arithmetic Error: +=
ndarray at mac.com
Tue Jul 18 12:54:41 CDT 2006
On 7/18/06, Alan G Isaac <aisaac at american.edu> wrote:
> it cannot upcast, as the '+=' operation will use only the
> memory initially allocated for a.
>>> x = [2,3]
>>> x += array(2)
This is just the design choice made by numpy.
I don't see the need for an error. Augmented assignment is a
feature that those who use it can be expected to know what it does.
Loosing imaginary part maybe a more compelling reason for an error
than loosing precision, but it would be clearly wrong to have
different types behave differently. Silent downcasting from float to
int is actually a useful feature.
More information about the Numpy-discussion