I wrote a straightforward Python function, and here it is:
def list_rindex(lst, item):
"""
Find first place item occurs in list, but starting at end of list.
Return index of item in list, or -1 if item not found in the list.
"""
i_max = len(lst)
i_limit = -i_max
i = -1
while i > i_limit:
if lst[i] == item:
return i_max + i
i -= 1
return -1
But while I was testing it, EwyynTomato posted a better answer. Use the "slicing" machinery to reverse the list and use the .index()
method.