[Matrix-SIG] raising an exception on sorting zero-length arrays

Charles G. Waldman cgw@pgt.com
Wed, 16 Dec 1998 10:50:54 -0500 (Eastern Standard Time)


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.