Convert elements of a list into binary
You can use bitwise operators like this:
>>> lst = [0, 1, 0, 0]
>>> bin(int(''.join(map(str, lst)), 2) << 1)
'0b1000'
This is not a fancy one-liner, but simple and fast.
lst = [0,1,1,0]
num = 0
for b in lst:
num = 2 * num + b
print(num) # 6