⬅︎ Back to Fastest way to uniqify a list in Python
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.
Comment
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.