Filtering a Python list to uniques

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Tue Mar 25 19:38:39 EDT 2008


Kelly Greer:
> What is the best way to filter a Python list to its unique members?

If Python is "batteries included", then an industrial-strength
unique() seems one of the most requested 'batteries' that's not
included :-) I feel that it's coming in Python 2.6/3.x. In the
meantime:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502263
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438599

Bye,
bearophile



More information about the Python-list mailing list