Re: [Numpy-discussion] np.equal

2009-12-07 Thread Charles R Harris
On Mon, Dec 7, 2009 at 12:01 AM, Fernando Perez wrote: > 2009/12/6 josef.pktd : > np.equal(np.arange(5),'a') > > NotImplemented > > Why is NotImplemented a *return* value? Normally NotImplementedError > NotImplemented and NotImplementedError are different things. The first is a message to t

Re: [Numpy-discussion] np.equal

2009-12-07 Thread Michael Droettboom
There was some discussion on this recently. "==" actually has special fall-back code for strings, whereas "equal" is just a "raw" ufunc, and no ufunc's support strings. http://www.mail-archive.com/numpy-discussion@scipy.org/msg21408.html Of course bool(NotImplemented) == True is sort of a sepa

Re: [Numpy-discussion] np.equal

2009-12-07 Thread Pauli Virtanen
su, 2009-12-06 kello 23:01 -0800, Fernando Perez kirjoitti: > 2009/12/6 josef.pktd : > np.equal(np.arange(5),'a') > > NotImplemented > > Why is NotImplemented a *return* value? Normally NotImplementedError > is a raised exception, but if it's not implemented, it shouldn't be > returned as a

Re: [Numpy-discussion] np.equal

2009-12-06 Thread Fernando Perez
2009/12/6 josef.pktd : np.equal(np.arange(5),'a') > NotImplemented Why is NotImplemented a *return* value? Normally NotImplementedError is a raised exception, but if it's not implemented, it shouldn't be returned as a value. For one thing, it leads to absurdities like the following being po

Re: [Numpy-discussion] np.equal

2009-12-06 Thread Keith Goodman
On Sun, Dec 6, 2009 at 4:57 AM, wrote: > what's the difference in the implementation between np.equal and == ? > np.equal raises NotImplemented for strings, while == works. > aa > array(['a', 'b', 'a', 'aa', 'a'], >      dtype='|S2') > aa == 'a' > array([ True, False,  True, False,  Tru

[Numpy-discussion] np.equal

2009-12-06 Thread josef . pktd
what's the difference in the implementation between np.equal and == ? np.equal raises NotImplemented for strings, while == works. >>> aa array(['a', 'b', 'a', 'aa', 'a'], dtype='|S2') >>> aa == 'a' array([ True, False, True, False, True], dtype=bool) >>> np.equal(aa,'a') NotImplemented