Finding the index of a numpy array in a list
<pre><code>import numpy as np
foo = [1, "hello", np.array([[1,2,3]]) ]
</code></pre>

<p>I would expect</p>

<pre><code>foo.index( np.array([[1,2,3]]) ) 
</code></pre>

<p>to return </p>

<pre><code>2
</code></pre>

<p>but instead I get</p>

<blockquote>
  <p>ValueError: The truth value of an array with more than one element is
  ambiguous. Use a.any() or a.all()</p>
</blockquote>

<p>anything better than my current solution? It seems inefficient.</p>

<pre><code>def find_index_of_array(list, array):
    for i in range(len(list)):
        if np.all(list[i]==array):
            return i

find_index_of_array(foo, np.array([[1,2,3]]) )
# 2
</code></pre>