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

Robert Kern robert.kern@gmail....
Tue Jan 31 09:18:26 CST 2012


On Tue, Jan 31, 2012 at 15:13, Benjamin Root <ben.root@ou.edu> wrote:

> Is np.all() using np.array() or np.asanyarray()?  If the latter, I would
> expect it to return a numpy array from a generator.

Why would you expect that?

[~/scratch]
|37> np.asanyarray(i>5 for i in range(10))
array(<generator object <genexpr> at 0xdc24a08>, dtype=object)

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the NumPy-Discussion mailing list