[Numpy-discussion] ufunc oddities

Alan G Isaac aisaac@american....
Sat May 24 22:21:55 CDT 2008


On Sat, 24 May 2008, Keith Goodman apparently wrote: 
>>> x = np.array([True, True], dtype=bool)
>>> x.sum()
>    2



If you want bools, change the accumulator dtype::

    >>> x.sum(dtype=bool)
    True

Cheers,
Alan Isaac





More information about the Numpy-discussion mailing list