[Tutor] Best Known Method for Filtering redundant list items.
python at venix.com
Thu Nov 30 22:23:25 CET 2006
Right after hitting send I realized I fail to preserver order. If
preserving order is important, we're back to using more complex code.
On Thu, 2006-11-30 at 16:01 -0500, Python wrote:
> On Thu, 2006-11-30 at 12:51 -0800, Chris Hengge wrote:
> > Anyone point me to something more efficient then
> list2 = list(set(list1))
> Older Pythons will force you to import sets and use sets.Set
> > 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.
> > _______________________________________________
> > Tutor maillist - Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor