Why is a False value (0) smaller in bytes than True (1)?
问题 I was playing around with sys 's getsizeof() and found that False (or 0 ) consists of less bytes than True (or 1 ). Why is that? import sys print("Zero: " + str(sys.getsizeof(0))) print("One: " + str(sys.getsizeof(1))) print("False: " + str(sys.getsizeof(False))) print("True: " + str(sys.getsizeof(True))) # Prints: # Zero: 24 # One: 28 # False: 24 # True: 28 In fact, other numbers (also some that consist of more than one digit) are 28 bytes. for n in range(0, 12): print(str(n) + ": " + str