Python built-in id() not consistent:
- by Dannellyz
Hoping someone can explain the following discrepancy:
>>> s1 = "Cyber security"
>>> s2 = "Cyber security"
>>> id(s1) == id(s1)
True
>>> id(s1) == id(s2)
False
>>> s1 = "cyber"
>>> s2 = "cyber"
>>> id(s1) == id(s2)
True
>>> s2 = "cyber "
>>> s2 = "cyber "
>>> id(s1) == id(s2)
False
Why does the space make the id() False, yet different variables with no spaces are True?