Created
September 30, 2014 18:42
-
-
Save embayer/cae628247f1a459b95f8 to your computer and use it in GitHub Desktop.
reduce duplicates in a sequence
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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