sturlamolden <[EMAIL PROTECTED]> writes: > def nonunique(lst): > slst = sorted(lst) > return list(set([s[0] for s in > filter(lambda t : t[0] != t[1], zip(slst[:-1],slst[1:]))]))
The items are all comparable and you're willing to take them out of order? from collections import defaultdict def nonunique(lst): d = defaultdict(int) for x in lst: d[x] += 1 return [x for x,n in d.iterkeys() if n > 1] -- http://mail.python.org/mailman/listinfo/python-list