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. Is there a faster better way to move my stock object from one list to another? (IE, without having to use a dictionary instead of a list or is that my only solution?)
[code] class stock: code = "NULL" price = 0 stock_list1 = [] stock_list2 = [] def transfer_stock(stock_code, old_list, new_list): """ Transfer a stock from one list to another """ # is there a more efficient & faster way to index = 0 for stock in old_list: temp_stock = stock if temp_stock.code == stock_code: new_list.append(temp_stock) del old_list[index] index += 1 return new_list[/code] -- http://mail.python.org/mailman/listinfo/python-list