My understanding is that all primitive types are referentially equal if they are equal in value.
With integers, this seems to be the case shown from the following example:
v1 = 2
v2 = 2
v1 is v2 # prints True
With booleans, this also seems to be the case shown from the following example:
v1 = False
v2 = False
v1 is v2 # prints True
With strings, it starts to get a little confusing. The following example follows the procedure:
v1 = 'testtest'
v2 = 'testtest'
v1 is v2 # prints True
However, as soon as I add a space to the string, it fails:
v1 = 'test test'
v2 = 'test test'
v1 is v2 # prints False
With floats, the pattern just doesn't exist:
v1 = 2.0
v2 = 2.0
v1 is v2 # prints False
Why do strings follow the rule except when spaces are added? Why do floats not follow the rule at all? Any help is appreciated.