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

Webb Sprague webb.sprague at gmail.com
Mon Apr 10 07:16:04 CDT 2006


>
> It's the python way:
>
> >>> a = [1,2,3]
> >>> a[-1]
> 3
>
> It gives a convenient way to index from the end of the array. But I'm not
> sure that was your question.

No there, was a bug in that when using one matrix to index another, in
that the indexing matrix gets changed. As if you did

>>> i = 4
>>> a = [1,2,3]
>>> a[i]
>>> print i
  -1

 I know about the negative trick in simple python lists, I was trying
to do something in matrices (where it works too, but that wasn't the
issue.

Thanks for trying to help, though.
W




More information about the Numpy-discussion mailing list