[Numpy-discussion] Bug in numpy all() function

Ryan May rmay@ou....
Wed Feb 6 09:11:20 CST 2008

Dan Goodman wrote:
> Hi all,
> I think this is a bug (I'm running Numpy
>>>> from numpy import *
>>>> def f(x): return False
>>>> all(f(x) for x in range(10))
> True
> I guess the all function doesn't know about generators?

That's likely the problem.  However, as of Python 2.5, there's a built
in function that will do what you want.  However, you would mask that
builtin with the from numpy import *.


Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

More information about the Numpy-discussion mailing list