This new function counts the number of 1-bits in a number. These work on all the numpy integer types, as well as the builtin arbitrary-precision Decimal and long types.
>>> a = np.array([2**i - 1 for i in range(16)])
>>> np.bit_count(a)
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15])