Python Frequently Asked Questions, Release 3.9.5 23 2.5. Sequences (Tuples/Lists) The list comprehension may be fastest. As with removing duplicates, explicitly iterating in reverse with a delete condition is one possibility. However, it is easier and faster to use slice replacement with an implicit or explicit forward iteration. Here are three variations.: This converts the list into a set, thereby removing duplicates, and then back into a list. If all elements of the list may be used as set keys (i.e. they are all hashable ) this is often faster mylist =list(set(mylist)) If you don’t mind reordering the list, sort it and then scan from the end of the list, deleting duplicates as you go: https://code.activestate.com/recipes/52560/ See the Python Cookbook for a long discussion of many ways to do this: This won’t touch your original sequence, but build a new copy with reversed order to iterate over. Use the$_{reversed()}$ built-in function: Python sequences are indexed with positive numbers and negative numbers. For positive numbers 0 is the first index 1 is the second index and so forth. For negative indices -1 is the last index and -2 is the penultimate (next to last) index and so forth. Think of seq[-n] as the same as seq[len(seq)-n] . Using negative indices can be very convenient. For example$_{S[:-1]}$ is all of the string except for its last character, which is useful for removing the trailing newline from a string. 2.5.2 What’s a negative index? 2.5.3 How do I iterate over a sequence in reverse order? 2.5.4 How do you remove duplicates from a list? 2.5.5 How do you remove multiple items from a list mylist[:]=filter(keep_function, mylist) mylist[:]=(x for x in mylist if keep_condition) mylist[:]=[x for x in mylist if keep_condition] if mylist: mylist.sort() last=mylist[-1] for i in range(len(mylist) -2,-1,-1): if last==mylist[i]: del mylist[i] else : last=mylist[i] for x in reversed(sequence): ... # do something with x ...