[Numpy-discussion] short circuit != ?
Wed Oct 27 08:37:23 CDT 2010
On 10/27/2010 03:31 PM, Neal Becker wrote:
> 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
> 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
In : a=np.array([2,3,
In : b=np.array([2,5,
In : np.any(a!=b)
it does not return a bool array, it seems. I do not see how you would
"broadcast" the notion of "any".... along axes maybe?
> NumPy-Discussion mailing list
More information about the NumPy-Discussion