I want to remove about 50000 elements from a list,which has 100000 elements. sample code like below:
>>> a=range(10) >>> b=range(4) >>> for x in b: ... a.remove(x) ... >>> a [4, 5, 6, 7, 8, 9] when a and b is small size, it will finished quickly, but when a and b have many elements. such as: >>> a=range(100000) >>> b=range(50000) >>> for x in b: ... a.remove(x) ... it will very slowly. Shall I change to another data structure and choos a better arithmetic? any suggestion is welcome. thanks a lot! -- http://mail.python.org/mailman/listinfo/python-list