Optimizing if statement check over a numpy value

Laura Creighton lac at openend.se
Thu Jul 23 06:13:21 EDT 2015


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





More information about the Python-list mailing list