Tiny thing, but numpy does not use C++ style comments, please use /* ... */ instead. Also I think this may need a bit of discussion. Seems like a nice idea to support both sort orders, but I see a small problem if you get a 1-element corner case, where I think you can get the wrong result if you think it is ordered descending but you get the default order?