def unique(a): if isinstance(a,collections.Hashable): c = set(a) else: c = [] for x in a: if x not in c: c.append(x) return c