I want to create a fixed size integer in python, for example 4 bytes. Coming from a C background, I expected that all the primitive types will occupy a constant space in mem
I have no idea if there's a better way to do this, but here's my naive approach:
def intn(n, num_bits=4): return min(2 ** num_bits - 1, n)