On Sun, Aug 30, 2015 at 9:09 PM, Jaime Fernández del Río <jaime.frio@gmail.com> wrote:

There are three ways of fixing this that I see:
  1. Arbitrarily choose a value to set the return to. This is equivalent to choosing a default return for `cmp` for comparisons. This preserves behavior, but feels wrong.
  2. Similarly to how np.sign of a floating point array with nans returns nan for those values, return e,g, None for these cases. This is my preferred option.
  3. Raise an error, along the lines of the TypeError: unorderable types that 3.x produces for some comparisons.
Having read the other replies so far -- given that no-one seems to have any clear intuition or use cases, I guess I find option 3 somewhat tempting... it keeps our options open until someone who actually cares comes along with a use case to hone our intuition on, and is very safe in the mean time.

(This was noticed in the course of routine code cleanups, right, not an external bug report? For all we know right now, no actual user has ever even tried to apply np.sign to an object array?)

-n

--
Nathaniel J. Smith -- http://vorpus.org