We can do this:
def rindex(array, value) -> int: i = array[::-1].index(value) return len(array) - i - 1
That will not revert array in memory address, then it avoids two array.reverse() calls.
array
array.reverse()