It seems to be a case of leaky abstraction, where the way python caches small objects becomes visible, another example:
>>> a = 'hn'
>>> a is 'hn'
True
>>> a = ''.join(['h', 'n'])
>>> a is 'hn'
False
>>> a
'hn'
>>> a = 'h' + 'n'
>>> a is 'hn'
True
Edit: found another interesting case >>> a = 1
>>> b = 1
>>> a is b
True
>>> a = 500
>>> b = 500
>>> a is b
False