[Numpy-discussion] Unexpected change of array used to index another array

Charles R Harris charlesr.harris at gmail.com
Sun Apr 9 22:21:02 CDT 2006

On 4/8/06, Webb Sprague <webb.sprague at gmail.com> wrote:
> Hi.
> I indexed an 10 x 10(called bigM below) with another array (OFFS_TMP
> below).  I suppose because OFFS_TMP has negative numbers, it was
> changed to cycle around to 9 wherever there is a negative 1 (which is
> the forward version of -1 if you are a 10 x 10 matrix).  You can
> analogous behavior with -2 => 8, etc.  Is changing the indexing matrix
> really the correct behavior?  The result of using the index seems to
> be fine.  Has this story been told already and I didn't know it?

It's the python way:

>>> a = [1,2,3]
>>> a[-1]

It gives a convenient way to index from the end of the array. But I'm not
sure that was your question.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060409/079b53d1/attachment.html 

More information about the Numpy-discussion mailing list