I wonder, is this more performant?
from collections import Counter c = Counter(arr) if any(x > 1 for x in c.values): return 'duplicate found' myset = set(c.keys()