On Fri, Apr 30, 2010 at 9:16 PM, Jimbo <nill...@yahoo.com> wrote: > Hello I have a relatively simple thing to do; move an object from one > to list into another. But I think my solution maybe inefficient & > slow. >
Removing an item from a list is O(n) on average, so it's going to be a bit slow any way you slice it (unless you only remove from the end of the list which is O(1)). Can you tell us more about why you're using a list? If the order of the items doesn't matter, you may be able to use a set(). If the order matters, how is the list ordered? If we know how the list is ordered, we may be able to help you come up with a clever way to remove an item cheaply. -- Daniel Stutzbach, Ph.D. President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
-- http://mail.python.org/mailman/listinfo/python-list