Are you sure that raising an exception when a user tries to sort a zero-length array is the best thing to do? The Python "list" type does not have this behavior: >>> l = [] [] >>> l.sort() Why should the array type behave so much differently, raising an exception? I think returning a zero-length array is the reasonable thing to do in this case.