[Tutor] Best Known Method for Filtering redundant list items.

Jordan Greenberg greenbergj at wit.edu
Thu Nov 30 22:11:48 CET 2006

Chris Hengge wrote:
> Anyone point me to something more efficient then
> for item in list1:
>     if item not in list2:
>           list2.append()
> This just seems to take a bit a time when there are thousands or dozens of
> thousands of records just to filter out the dozen or so copies..
> Thanks.

somewhat unsurprisingly, the first thing google lists for "python list
duplicates" is a quite good ASPN recipe to do just what you want.

More information about the Tutor mailing list