Skip to content

Instantly share code, notes, and snippets.

@adambene
Created July 2, 2020 23:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adambene/fecfa30e44f006c2d09ef2308a0acf34 to your computer and use it in GitHub Desktop.
Save adambene/fecfa30e44f006c2d09ef2308a0acf34 to your computer and use it in GitHub Desktop.
def distinct_preserve_order(items):
seen = set()
result = list()
for item in items:
if item not in seen:
seen.add(item)
result.append(item)
return list(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment