Matthew Koichi Grimes wrote: > Is this a bug? It seems like having to generate a whole list before > calling any() defeats the whole appeal of using any() in the first > place; namely that it'll exit on the first False returned by the > generator, without going through the rest of the elements.
No, it's not really a bug; it's a consequence of the fact that we can't reliably "just build an array" from any given generator without extra information. And even then, it's tricky. The generator object is being turned into a numpy.object_ scalar type; that's why you get the result that you do. Most numpy functions operate on arrays or things that can be turned into arrays. They don't operate in ideal ways on every kind of object that you might throw at them. -- 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 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion