ma, 2010-12-20 kello 15:32 -0700, Justin Peel kirjoitti:
> I'm using version 2.0.0.dev8716, which should be new enough I would
> think. Let me show you what makes me think that there isn't
> short-circuiting going on.
>
> I'll do two timeit's from the command line:
>
> $ python -m timeit -s 'imp
I'm using version 2.0.0.dev8716, which should be new enough I would
think. Let me show you what makes me think that there isn't
short-circuiting going on.
I'll do two timeit's from the command line:
$ python -m timeit -s 'import numpy as np; x = np.ones(20)' 'x.all()'
100 loops, best of 3: 3
On Mon, Dec 20, 2010 at 1:25 PM, Justin Peel wrote:
> 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
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