I just thought of doing
mylist = list(set(mylist))
to remove all duplicate entries from mylist
. However, chaining built-ins always feels a little hacky. I am wondering, what is the (most) pythonic/zen way of eliminating duplicates from a list?
While searching, I found the above constuct as an answer to the "eliminate duplicates"-problem here on stackoverflow. Nobody cried this is a bad idea, but that's only implying an answer and explicit is better than implicit.
Is the above construct the way of eliminating duplicates from a list (of hashable elements)?
If not, what is?