Hacker News new | ask | show | jobs
by occams_chainsaw 2689 days ago
Easier:

  no_duplicates = set(<list>)
1 comments

Except that won't return a list. You need list(set(<list>)). Also using set means you lose list ordering, which isn't the case when using dict (assuming python 3.6 or higher).

That being said, and not that it should ever make a difference, list(set(<list>)) is 2-3 times faster than list(dict.fromkeys(<list>))