title: Python: Why slice works in this way?
body: <p>In the official Python Tutorial (2.7), it is said that slice makes a shallow copy of the list (for eg) and each item in a slice is a reference to the original list object. </p>
  
  <p>For eg, doing </p>
  
  <pre><code>a = [1,2,3]
  a[:][0] = 2
  </code></pre>
  
  <p>will not change the actual value cause what happens is merely the first item in the slice is referenced to a new object (which is 2). </p>
  
  <p>However, doing </p>
  
  <pre><code>a[:] = [] # or any other list
  </code></pre>
  
  <p>will actually change the list. </p>
  
  <p>Can anybody explain that?</p>