Something about the id of objects of type str (in python 2.7) puzzles me. The str type is immutable, so I would expect that once it is
id
str
In your first example a new instance of the string 'so' is created each time, hence different id.
'so'
In the second example you are binding the string to a variable and Python can then maintain a shared copy of the string.