[Numpy-discussion] Nasty bug using pre-initialized arrays

Stuart Brorson sdb@cloud9....
Fri Jan 4 16:17:56 CST 2008

>> I realize NumPy != Matlab, but I'd wager that most users would think
>> that this is the natural behavior......
> Well, that behavior won't happen. We won't mutate the dtype of the array because
> of assignment. Matlab has copy(-on-write) semantics for things like slices while
> we have view semantics. We can't safely do the reallocation of memory [1].

That's fair enough.  But then I think NumPy should consistently
typecheck all assignmetns and throw an exception if the user attempts
an assignment which looses information.

If you point me to a file where assignments are done (particularly
from array elements to array elements) I can see if I can figure out
how to fix it & then submit a patch.  But I won't promise anything!
My brain hurts already after analyzing this "feature".....   :-)


Stuart Brorson
Interactive Supercomputing, inc.
135 Beaver Street | Waltham | MA | 02452 | USA

More information about the Numpy-discussion mailing list