Take a look at the sorted collection recipe: http://code.activestate.com/recipes/577197-sortedcollection/
You want myList to be a sorted List. You want lookups to be fast. See if that improves things enough for you. It may be possible to have better speedups if instead of myList you write myTree and store the values in a tree, depending on what the values of id are -- it could be completely useless for you, as well. Laura -- https://mail.python.org/mailman/listinfo/python-list