Numeric array equivalent of index ?

Robert Kern robert.kern at
Sat Oct 15 03:29:59 CEST 2005

Nicolas Pernetty wrote:
> Hello,
> I'm trying to find a clear and fast equivalent to the index method of
> plain python list :
>>>a = [5,1,4,3,4]
> 2
> I have to use it on a Numeric array, so the best I've come up with is
> (rather ugly I think) :
>>>from Numeric import array, equal, nonzero
>>>a = array([5,1,4,3,4])
> 2
> Does someone know of a more Pythonic way ?

There's a list for Numeric. You'll get better answers there.

And no, no one has bothered adding a .index() equivalent for general,
unsorted arrays.

Robert Kern
rkern at

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter

More information about the Python-list mailing list