title: Find the minimum and maximum indices of a list given a condition
body: <p>I have a list, let's say: </p>
  
  <pre><code>list_A = [0,0,0,1.0,2.0,3.0,2.0,1.0,0,0,0]
  </code></pre>
  
  <p>I would like to find the minimum and maximum indices of this list where <code>list_A &gt; 0</code>, i.e. in the above example, it would be 3 and 7. </p>
  
  <p>For other lists, which increase monotonically, I have been using <code>np.searchsorted</code>, like <code>np.searchsorted(list,[0.5,1.0])</code> to find the indices wherein the list is <code>between 0.5 and 1.0</code> respectively. </p>
  
  <p>But this case is quite different and the <code>np.searchsorted</code> doesn't work here, or maybe it does in a way which I don't know !</p>