You could do it with a class, like this, I guess it is a bit faster than option 1, although I'm no connaisseur of python internals..... -class uniquelist(list): - def __init__(self, l): - for item in l: - self.append(item)
- def append(self, item): - if item not in self: - list.append(self, item) -l = [1, 1, 2, 3, 3, 4] -print l -m = uniquelist(l) -print m -- http://mail.python.org/mailman/listinfo/python-list