Open
Description
Numpy's any() (and all()) functions should work with generator expressions to be consistent with basic python. I spent several hours trying to debug a case of this, which would work if I used a list, but not if I used a generator expression -- only to discover that it was because numpy's all() function was being used instead of the usual python one that works identically with both generators and lists.
lst = [0,1,2]
print any(i < 0 for i in lst) # False
from numpy import any
print any([i < 0 for i in lst]) # False
print any(i < 0 for i in lst) # <generator object <genexpr> at 0x1006bd500>
Metadata
Metadata
Assignees
Labels
No labels