Does each variable which gets assigned a True or False (e.g: variable = True), reference two constant, unchanging addresses in memory which are reserved for holding respectively True and False?
In context: I was researching the difference between == and is in this thread, from which (according to my understanding) i learned that == compares the values of two objects, and is checks whether or not two objects are one and the same (or rather, whether they occupy the same address in memory).
Then i tried out the following code:
foo = False
if foo is False:
print("1")
I was expecting for an error to occur, but it didn't (thinking that 'False' would be treated as a value, and is not being able to deal with a value). Instead it passed.
So is my guess correct? Does every boolean variable in fact constantly reference two objects in memory with an unchanging address (True and False)?