Re: [Numpy-discussion] Question about bounds checking

2009-08-12 Thread Robert Kern
On Mon, Aug 10, 2009 at 10:08, Rich E wrote: > Dear all, > I am having a few issues with indexing in numpy and wondered if you could help > me out. > If I define an array > a = zeros(( 4)) > a > array([ 0.,  0.,  0.,  0.]) > > Then I try and reference a point beyond the bounds of the array > > a[4]

Re: [Numpy-discussion] Question about bounds checking

2009-08-10 Thread Chris Colbert
when you use slice notation, [0:4] returns everything up-to but not including index 4. That is a[4] is actually the 5th element of the array (which doesn't exist) because arrays are zero-based in python. http://docs.scipy.org/doc/numpy-1.3.x/user/basics.indexing.html On Mon, Aug 10, 2009 at 11:0

[Numpy-discussion] Question about bounds checking

2009-08-10 Thread Rich E
Dear all, I am having a few issues with indexing in numpy and wondered if you could help me out. If I define an array a = zeros(( 4)) a array([ 0., 0., 0., 0.]) Then I try and reference a point beyond the bounds of the array a[4] Traceback (most recent call last): File "", line 1, in IndexE