![](https://secure.gravatar.com/avatar/96dd777e397ab128fedab46af97a3a4a.jpg?s=120&d=mm&r=g)
Sept. 29, 2015
6:53 p.m.
On Tue, Sep 29, 2015 at 12:16 PM, Nathaniel Smith <njs@pobox.com> wrote:
On Sep 29, 2015 8:25 AM, "Anne Archibald" <archibald@astron.nl> 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