Removing dupes from a list

David Eppstein eppstein at ics.uci.edu
Sat Apr 27 15:16:16 EDT 2002


In article <a2972632.0204271058.72ac51cf at posting.google.com>,
 les_ander at yahoo.com (les ander) wrote:

> > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
> > 
> > 
> > Alex
> 
> 
> def unique(List):
>   return list(dict(zip(List,[None]*len(List))))

The ASPN recipe also works for mutable list members.

-- 
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/



More information about the Python-list mailing list