Something I'm not quite understanding with strings in python
>>> a = "dog"
>>> id(a)
140438787418232
>>> id("d" + "o" + "g")
140438787418232
>>> b = "dog"
>>> id(b)
140438787418232
That behaved how I'd expect it to, however if I use a string with whitespace in it...
>>> a = "a dog"
>>> id(a)
140438787452384
>>> id("a" + " " + "d" + "o" + "g")
140438787452288
>>> b = "a dog"
>>> id(b)
140438787452144
The interpreter doesn't resolve the identical strings to the same memory address this time round. Why is that?