Optimizing if statement check over a numpy value

Laura Creighton lac at openend.se
Thu Jul 23 12:13:21 CEST 2015

Take a look at the sorted collection recipe:

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.


More information about the Python-list mailing list