Popular recipes tagged "list_comprehension" and "numpy"http://code.activestate.com/recipes/tags/list_comprehension+numpy/2012-03-13T16:21:36-07:00ActiveState Code RecipesFast Indexing functions (greater than, less than, equal to, and not equal to) (Python)
2012-03-13T16:21:36-07:00Garretthttp://code.activestate.com/recipes/users/4181290/http://code.activestate.com/recipes/578071-fast-indexing-functions-greater-than-less-than-equ/
<p style="color: grey">
Python
recipe 578071
by <a href="/recipes/users/4181290/">Garrett</a>
(<a href="/recipes/tags/index/">index</a>, <a href="/recipes/tags/list/">list</a>, <a href="/recipes/tags/list_comprehension/">list_comprehension</a>, <a href="/recipes/tags/numpy/">numpy</a>, <a href="/recipes/tags/python/">python</a>).
Revision 2.
</p>
<p>Oftentimes you want to find the index of a list-like object. Numpy arrays, for example, do not have a index member function. These get the job done quickly.</p>
<p>Note: these do not raise exceptions, instead they return -1 on error. You should change that if you want different behavior.</p>