There is a list L. It contains elements of arbitrary type each. How to delete all duplicate elements in such list efficiently? ORDE
One line solution in Python. Using lists-comprehesion:
>>> L = [2, 1, 4, 3, 5, 1, 2, 1, 1, 6, 5] >>> M = [] >>> zip(*[(e,M.append(e)) for e in L if not e in M])[0] (2, 1, 4, 3, 5, 6)