Skip to content

Instantly share code, notes, and snippets.

@embayer
Created September 30, 2014 18:42
Show Gist options
  • Save embayer/cae628247f1a459b95f8 to your computer and use it in GitHub Desktop.
Save embayer/cae628247f1a459b95f8 to your computer and use it in GitHub Desktop.
reduce duplicates in a sequence
def kill_duplicates(seq):
seen = set()
seen_add = seen.add
return [ x for x in seq if not (x in seen or seen_add(x))]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment