title: Using 'is' operator to compare two string slices in python
body: <p>I was experimenting with string slicing in python, and this is my code:</p>
  
  <pre><code>s = 'a string'
  print(id(s[3:]), id(s[5:]))
  print(id(s[3:])==id(s[5:]))
  print(s[3:] is s[5:])
  print(s[3:] is s[3:])
  </code></pre>
  
  <p>The code produced the following results:</p>
  
  <pre><code>4396519216 4396519216
  True
  False
  False
  </code></pre>
  
  <p>My question is how those string slices are stored in memory, why do different slices of a string have the same id, and with the same id, why do they yield 'False' when compared using 'is' keyword?</p>