Is there a more efficient way to do this?

def f(L):
    '''Return a set of the items that occur more than once in L.'''
    L = list(L)
    for item in set(L):
        L.remove(item)
    return set(L)


|>> f([0, 0, 1, 1, 2, 2, 3])
set([0, 1, 2])



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to