Iterating over the cells of an array?

John J. Lee jjl at pobox.com
Sun May 12 11:38:58 EDT 2002


On Sun, 12 May 2002, Alex Martelli wrote:

> Fernando PĂ©rez wrote:
>         ...
> > ravel is I believe a copy operation, much more expensive than a call to
>
> Chacking isn't all that expensive, is it?
[...]
> >>> f=Numeric.ravel(x)
[...]
> >>> x[1,1]=111
[...]
> >>> f
> array([  0,   1,   2,   3,   1, 111,   3,   4,   2,   3,   4,   5])

If the array is not contiguous, though, it will make a copy.


John




More information about the Python-list mailing list