Removing duplicates from a list

Rocco Moretti roccomoretti at hotpop.com
Wed Sep 14 16:18:45 CEST 2005


Rubinho wrote:

> I can't imagine one being much faster than the other except in the case
> of a huge list and mine's going to typically have less than 1000
> elements.  

To add to what others said, I'd imagine that the technique that's going 
to be fastest is going to depend not only on the length of the list, but 
also the estimated redundancy. (i.e. a technique that gives good 
performance with a list that has only one or two elements duplicated 
might be painfully slow when there is 10-100 copies of each element.)

There really is no substitute for profiling with representitive data sets.



More information about the Python-list mailing list