[Numpy-discussion] Short circuiting the all() and any() methods/functions
Mon Dec 20 14:25:29 CST 2010
It has come to my attention that the all() and any() methods/functions
do not short circuit. It takes nearly as much time to call any() on an
array which has 1 as the first entry as it does to call it on an array
of the same size full of zeros.
The cause of the problem is that all() and any() just call reduce()
with the appropriate operator. Is anyone opposed to changing the
implementations of these functions so that they short-circuit?
By the way, Python already short circuits all() and any() correctly so
it certainly makes sense to enact this change.
I'm willing to head this up if there isn't any opposition to it.
More information about the NumPy-Discussion