convert numpy binary (0|1) to integer ?

b = np.random.randint(0,2,(50)) 
b.dot(2**np.arange(b.size)[::-1]) 
b.dot(1 << np.arange(b.size)[::-1])