Skip to content

Instantly share code, notes, and snippets.

@adambene
Created July 2, 2020 22:52
Show Gist options
  • Save adambene/cd0d9f568e4ba797ce2de345f6284ba4 to your computer and use it in GitHub Desktop.
Save adambene/cd0d9f568e4ba797ce2de345f6284ba4 to your computer and use it in GitHub Desktop.
def distinct_set(items):
result = set()
for item in items:
# Checking is not needed, because the list.add() method is idempotent
result.add(item)
return list(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment