<br><br><div class="gmail_quote">On Tue, Jan 31, 2012 at 9:18 AM, Robert Kern <span dir="ltr"><<a href="mailto:robert.kern@gmail.com">robert.kern@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="im">On Tue, Jan 31, 2012 at 15:13, Benjamin Root <<a href="mailto:ben.root@ou.edu">ben.root@ou.edu</a>> wrote:<br>
<br>
> Is np.all() using np.array() or np.asanyarray()?  If the latter, I would<br>
> expect it to return a numpy array from a generator.<br>
<br>
</div>Why would you expect that?<br>
<br>
[~/scratch]<br>
|37> np.asanyarray(i>5 for i in range(10))<br>
array(<generator object <genexpr> at 0xdc24a08>, dtype=object)<br>
<div class="im HOEnZb"><br>
--<br>
Robert Kern<br></div></blockquote><div><br>What possible use-case could there be for a numpy array of generators?  Furthermore, from the documentation:<br><br>numpy.asanyarray = asanyarray(a, dtype=None, order=None, maskna=None, ownmaskna=False)<br>

     Convert the input to an ndarray, but pass ndarray subclasses through.<br>    <br>     Parameters<br>     ----------<br>     a : array_like<br>         <b>Input data, in any form that can be converted to an array</b>.  This<br>

         includes scalars, lists, lists of tuples, tuples, tuples of tuples,<br>         tuples of lists, and ndarrays.<br> <br>Emphasis mine.  A generator is an input that could be converted into an array.  (Setting aside the issue of non-terminating generators such as those from cycle()).<br>

<br>Ben Root<br><br></div></div>