<br><br>On Tuesday, January 31, 2012, Alan G Isaac <<a href="mailto:alan.isaac@gmail.com">alan.isaac@gmail.com</a>> wrote:<br>> On 1/31/2012 8:26 AM, Neal Becker wrote:<br>>> I was just bitten by this unexpected behavior:<br>
>><br>>> In [24]: all ([i>   0 for i in xrange (10)])<br>>> Out[24]: False<br>>><br>>> In [25]: all (i>   0 for i in xrange (10))<br>>> Out[25]: True<br>>><br>>> Turns out:<br>
>> In [31]: all is numpy.all<br>>> Out[31]: True<br>><br>><br>>>>> np.array([i>  0 for i in xrange (10)])<br>> array([False,  True,  True,  True,  True,  True,  True,  True,  True,  True], dtype=bool)<br>
>>>> np.array(i>  0 for i in xrange (10))<br>> array(<generator object <genexpr> at 0x0267A210>, dtype=object)<br>>>>> import this<br>><br>><br>> Cheers,<br>> Alan<br>
> <br><br>Is np.all() using np.array() or np.asanyarray()?  If the latter, I would expect it to return a numpy array from a generator.  If the former, why isn't it using asanyarray()?<br><br>Ben Root<br>