On Tue, Sep 29, 2015 at 12:16 PM, Nathaniel Smith <n...@pobox.com> wrote:

> On Sep 29, 2015 8:25 AM, "Anne Archibald" <archib...@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
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
https://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to