title: Selecting indexes of elements with a common property in Python
body: <p>I have a numpy array and would like to obtain the indexes of the elements that verify a common property. For example, suppose the array is <code>np.array([1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1])</code>, and I want to have the indexes of all elements equal to 1, so the output would be <code>[0, 4, 5, 8, 10, 14]</code>.</p>
  
  <p>I have defined the following procedure</p>
  
  <pre><code>def find_indexes(A):
      res = []
      for i in range(len(A)):
          if A[i] == 1:
              res.append(i)
      return res
  </code></pre>
  
  <p>Is there a more "pythonesque" way of doing this? More specifically, I am wondering if there is something similar to boolean indexing:</p>
  
  <pre><code>A[A&gt;=1]
  </code></pre>
  
  <p>that would return the indexes of the elements rather than the elements themselves.</p>