You could create a class based on a list which takes a list as argument, like this: -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
will print py:[1, 1, 2, 3, 3, 4] py:[1, 2, 3, 4] -- http://mail.python.org/mailman/listinfo/python-list