title: What does colon at assignment for list[:] = [...] do in Python
body: <p>I came accross the following code:</p>
  
  <pre><code># O(n) space       
  def rotate(self, nums, k):
      deque = collections.deque(nums)
      k %= len(nums)
      for _ in xrange(k):
          deque.appendleft(deque.pop())
      nums[:] = list(deque) # &lt;- Code in question
  </code></pre>
  
  <p>What does <code>nums[:] =</code> do that <code>nums =</code> does not? For that matter, what does <code>nums[:]</code> do that <code>nums</code> does not?</p>