I have an integer, and would like to cast it as a tuple of boolean-likes— {0, 1} specifically. The way which comes to mind is tuple(int(b) for b in bin(my_int)[2:]), but feels off. What is the idiomatic/canonical way perform this?
Edit: for clarity, if the integer is 3, the tuple would be (0, 0, 0, 0, 0, 0, 1, 1). To further clarify, assume the integer is in {0, 1, …, 255} and the tuple’s length should be eight. So what I have at this point (but aim to improve) is tuple(int(b) for b in bin(my_int)[2:].zfill(8))