29 Sep
2015
29 Sep
'15
12:53 p.m.
On Tue, Sep 29, 2015 at 12:16 PM, Nathaniel Smith
On Sep 29, 2015 8:25 AM, "Anne Archibald"
wrote: IEEE 754 has signum(NaN)->NaN. So does np.sign on floating-point arrays.
Why should it be different for object arrays?
The argument for doing it this way would be that arbitrary python objects don't have a sign, and the natural way to implement something like np.sign's semantics using only the "object" interface is
if obj < 0: return -1 elif obj > 0: return 1 elif obj == 0: return 0 else: raise
That is what current master does, using PyObject_RichCompareBool for the comparisons. Chuck