Most viewed recipes tagged "is"http://code.activestate.com/recipes/tags/is/views/2008-08-16T19:41:37-07:00ActiveState Code Recipesget index of element in list using identity (Python)
2008-08-16T19:41:37-07:00nosklohttp://code.activestate.com/recipes/users/4166478/http://code.activestate.com/recipes/576426-get-index-of-element-in-list-using-identity/
<p style="color: grey">
Python
recipe 576426
by <a href="/recipes/users/4166478/">nosklo</a>
(<a href="/recipes/tags/compare/">compare</a>, <a href="/recipes/tags/comparision/">comparision</a>, <a href="/recipes/tags/find/">find</a>, <a href="/recipes/tags/identity/">identity</a>, <a href="/recipes/tags/index/">index</a>, <a href="/recipes/tags/is/">is</a>, <a href="/recipes/tags/same_object/">same_object</a>, <a href="/recipes/tags/search/">search</a>).
Revision 2.
</p>
<p>my_list.index(element) returns the index of the element using common comparision (as in == or __eq__() or __cmp__()). If you need to find an element on the list using identity comparing (is) then this function can do it for you</p>