[Numpy-discussion] missing array type

Sasha ndarray at mac.com
Tue Feb 28 10:48:09 CST 2006


On 2/28/06, Christopher Barker <Chris.Barker at noaa.gov> wrote:
> ...
> So what should the result of x += arange(5) be? I say it should raise an
> exception.

Agree. That's what I was proposing as a feasible (as opposed to ideal) solution.
Ideally, x += [1,1,1,1,1] would be fine, but not  x += [1,2,1,2,1].  I
quoted too much
from an early post.
>
> Maybe zero-stride arrays are only really useful read-only?
>
Maybe. It is hard to justify x[1] = 2 changing the result of x[0], but
x[:] = 2 may still be ok.

> This is a complicated can of worms.....

Completely agree.  That's why I made x.strides = 0 illegal some time
ago.  I don't think it is a good idea to bring it back without
understanding all the consequences.  If we allow it now, it will be
harder to change the behavior of the result later. Someone's code will
rely on x += ones(5) incrementing x five times for zero-stride x.




More information about the Numpy-discussion mailing list