Tim Chase  <[EMAIL PROTECTED]> wrote:
>Another attempt might be to try
>
> >>> a = [x for x in a if x not in b]
>
>However, this is still doing A*B checks, and will likely 
>degrade with as their sizes increase.

Combine this with the use of sets others have suggested if the
order of a matters, ie:

>>> bset = set(b)
>>> a = [ x for x in a if x not in bset ]

which gets you down to O(A) since set membership is O(1).

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to