[Numpy-discussion] short circuit != ?

Neal Becker ndbecker2@gmail....
Wed Oct 27 09:34:50 CDT 2010


Pauli Virtanen wrote:

> Wed, 27 Oct 2010 09:44:59 -0400, Skipper Seabold wrote:
> [clip]
>> In [35]: timeit np.any(a!=b)
> [clip]
>> It seems to at least take less time when the difference is at the
>> "beginning," though I'm sure there could be exceptions.
> 
> It performs all the comparisons to create a temporary boolean array.
> any() does return when it sees the first True, but this is not full
> short-circuiting.
> 

I propose adding is_equal(a,b) function which does true short-ciruciting 



More information about the NumPy-Discussion mailing list