[SciPy-user] indexing arrays with 'long int' doesn't work

Christian Kristukat ckkart at hoc.net
Thu Nov 10 04:06:44 CST 2005


Hi,
with old scipy (current svn checkout) I encountered problems when using a long
int array (python array module) to index a scipy array. 'take' works but looping
does not:

In [1]:import scipy_base

In [2]:import array as ar

In [3]:a = ar.array('L')

In [4]:a.fromlist([0,1,2])

In [5]:b = array([4,6,3,4,])

In [6]:take(b,a)
Out[6]:array([4, 6, 3])
In [8]:for i in a:
   ...:    print b[i]
   ...:
---------------------------------------------------------------------------
exceptions.IndexError         Traceback (most recent call  last)

/home/ck/<console>

IndexError: index must be either an int or a sequence

Christian



More information about the SciPy-user mailing list