title: Why does `mylist[:] = reversed(mylist)` work?
body: <p>The following reverses a list "in-place" and works in Python 2 and 3:</p>
  
  <pre><code>&gt;&gt;&gt; mylist = [1, 2, 3, 4, 5]
  &gt;&gt;&gt; mylist[:] = reversed(mylist)
  &gt;&gt;&gt; mylist
  [5, 4, 3, 2, 1]
  </code></pre>
  
  <p>Why/how? Since <code>reversed</code> gives me an iterator and doesn't copy the list beforehand, and since <code>[:]=</code> replaces "in-place", I am surprised. And the following, also using <code>reversed</code>, breaks as expected:</p>
  
  <pre><code>&gt;&gt;&gt; mylist = [1, 2, 3, 4, 5]
  &gt;&gt;&gt; for i, item in enumerate(reversed(mylist)):
          mylist[i] = item
  &gt;&gt;&gt; mylist
  [5, 4, 3, 4, 5]
  </code></pre>
  
  <p>Why doesn't the <code>[:] =</code> fail like that?</p>
  
  <p>And yes, I do know <code>mylist.reverse()</code>.</p>