Best way to make a list unique?
steven.bethard at gmail.com
Tue Mar 8 23:55:08 CET 2005
Delaney, Timothy C (Timothy) wrote:
> This is actually one thing that Java 1.5 has that I'd like to see in
> Python - the LinkedHashSet and LinkedHashMap. Very useful data
> For those who don't know, these implement a hash set/map which iterates
> in the order that the keys were first added to the set/map.
> Such a data structure is fairly simple to implement, and removing
> duplicates then becomes:
> unique = list(linkedset(orig))
> and you're guaranteed to maintain order.
> Implementing these is fairly simple.
Sounds like a good candidate for the collections module. Of course
someone will need to implement it. ;)
More information about the Python-list