Why is a False value (0) smaller in bytes than True (1)?
Remember that Python int values are of arbitrary size. How does that work? Well, in CPython,1 an int is represented by a PyLong_Object, which has an array of 4-byte chunks2, each holding 30 bits3 worth of the number. 0 takes no chunks at all. 1 – (1<<30)-1 takes 1 chunk. 1<<30 – (1<<60)-1 takes 2 … Read more