[Numpy-discussion] numpy all unexpected result (generator)

Neal Becker ndbecker2 at gmail.com
Tue Jan 31 08:26:34 EST 2012

I was just bitten by this unexpected behavior:

In [24]: all ([i>  0 for i in xrange (10)])
Out[24]: False

In [25]: all (i>  0 for i in xrange (10))
Out[25]: True

Turns out:
In [31]: all is numpy.all
Out[31]: True

So numpy.all doesn't seem to do what I would expect when given a generator.  

More information about the NumPy-Discussion mailing list