[Numpy-discussion] adding booleans

josef.pktd at gmail.com josef.pktd at gmail.com
Fri Jun 7 16:58:01 EDT 2013


Interesting observation, (while lurking on a pull request)

>>> np.add.reduce(np.arange(5)<3)
3
>>> np.add((np.arange(5)<3), (np.arange(5)<3))
array([ True,  True,  True, False, False], dtype=bool)


I often use summing of an array of boolean but didn't know the second behavior

Josef



More information about the NumPy-Discussion mailing list