[Numpy-discussion] short circuit != ?

Neal Becker ndbecker2 at gmail.com
Wed Oct 27 09:31:52 EDT 2010


Johann Cohen-Tanugi wrote:

> how about np.any(a!=b)  ??
> 
> On 10/27/2010 12:25 PM, Neal Becker wrote:
>> Is there a way to get a short circuit != ?
>>
>> That is, compare 2 arrays but stop as soon as the first element
>> comparison fails?
>>
>> I'm assuming that np.all (a != b) will _not_ do this, but will first
>> compare all elements.
>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
>>

I don't think that will do short ciruit, will it?  I think that will compare 
each element, returning a bool array, then short-circuit eval that bool 
array.




More information about the NumPy-Discussion mailing list