Another way to do this, that also maintains order, is: >>> l = [3, 1, 'a', '@', -4, 'z', 'r', 1, '@', -4] >>> s = set() >>> l2 = [] >>> for v in l: ... if not v in s: ... s.add(v) ... l2.append(v) ... >>> l2 [3, 1, 'a', '@', -4, 'z', 'r']
I have no idea whether or not this is more efficient than the other method; try it on big lists if you want to know. (But I like the idea that I'm not looking up indexes in the old list all the time, which just feels slow to me) cheers, --Tim -- http://mail.python.org/mailman/listinfo/python-list