I've done that and decided that Python's 'list comprehension' isn't a way to go. I was hoping that perhaps someone had some experience with some C or C++ library that has a Python interface that would make a difference.
Chaz Sybren Stuvel wrote: > Bill Williams enlightened us with: >> I don't know enough about Python internals, but the suggested >> solutions all seem to involve scanning bigList. Can this presumably >> linear operation be avoided by using dict or similar to find all >> occurrences of smallist items in biglist and then deleting those >> occurrences? > > And how would that beat O(n)? Every element of bigList has to be > scanned at one point, either to compare it to every earlier element in > bigList and eliminate it, or to compare it to every element in > smallList. > > Run benchmarks on the suggestions, and see which is fastest for > yourself. > > Sybren -- http://mail.python.org/mailman/listinfo/python-list