Comment

Aaron Swan

I needed the index of the unique elements in an order preserved manner, so I made a small modification to f8:

seen = set()
[i for (i,x) in enumerate(seq) if x not in seen and not seen.add(x)]

Hope this is helpful to someone.

Great post. Thank you.