There’s a trick for just getting the 1’s out of the binary representation without having to iterate over all the intervening 0’s:
def bits(n):
while n:
b = n & (~n+1)
yield b
n ^= b
>>> for b in bits(109):
print(b)
1
4
8
32
64