On Thu, May 27, 2010 at 9:59 AM, <[email protected]> wrote:
> A while ago we had a brief discussion about this.
>
>
> Is this a feature? or should there be a ticket for this
>
> >>> np.sqrt('5')
> NotImplemented
> >>> a = np.sqrt('5')
> >>> a
> NotImplemented
> >>> type(a)
> <type 'NotImplementedType'>
>
>
What numpy version? I get
In [2]: sqrt(['a'])
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
/home/charris/<ipython console> in <module>()
NotImplementedError: Not implemented for this type
In [3]: sqrt('a')
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
/home/charris/<ipython console> in <module>()
NotImplementedError: Not implemented for this type
Which is entirely different. Note that Py_NotImplemented is *not* only for
comparisons, it is a signal to the interpreter to try the r* version of a
binary operator.
OTOH,
In [4]: maximum('a',1)
Out[4]: NotImplemented
Which is still a problem. I think no ufunc should return NotImplemented, it
should be reserved to methods so the interpreter will handle it correctly.
Chuck
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion