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

Chris Hengge pyro9219 at gmail.com
Fri Dec 1 21:00:34 CET 2006


Somewhat less sarcastic... I did omg find that answer, and I didn't feel
like this was such a unique thing to do that I needed to re-invent the wheel
by building several methods to do something that a common library should
already have.

On 11/30/06, Jordan Greenberg <greenbergj at wit.edu> wrote:
>
> 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.
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20061201/1ef2a96d/attachment.htm 


More information about the Tutor mailing list