I can split an array into two smaller arrays like this:
>>> import numpy as np
>>> a = np.array([1,2,3,4,5])
>>> selector = np.array([True, False, True, True, False])
>>> selected, not_selected = a[selector], a[~ selector]
>>> selected
array([1, 3, 4])
>>> not_selected
array([2, 5])
But, even though I am generating selected and not_selected on the same line, I am (at least I think I am) effectively operating on a twice, once with selector and again with its inverse. How would I generate selected and not_selected using a truly single, and presumably faster, numpy operation? Or is this still the best way to do it?