I came across this really cool blog post outlining various fast ways to remove duplicate values from a Python list.
Here's the fastest order-preserving example:
def f12(seq): return list(dict.fromkeys(seq)) my_list = [1,2,2,2,3,4,5,6,6,6,6] print (f12(my_list))
[1, 2, 3, 4, 5, 6]
This really quick solution appears to have been identified by a chap called Raymond Hettinger, so credit where it's due!