Looking at the following IPython (Python 3.7) session:
In [1]: id('hello')
Out[1]: 140300950123104
In [2]: id('hello')
Out[2]: 140300963300384
In [3]: 'hello' is 'hello'
Out[3]: True
In [4]: '{} - {}'.format(id('hello'), id('hello'))
Out[4]: '140300946565808 - 140300946565808'
Expressions 1 and 2 indicate that each time the string hello
is initialized, it does get a different id. However, when initialized in the same expression, they seem to get the same id as the results of expressions 3 and 4 suggest. Why is that so?