Understanding dict.copy() - shallow or deep?
<p>While reading up the documentation for <code>dict.copy()</code>, it says that it makes a shallow copy of the dictionary. Same goes for the book I am following (Beazley's Python Reference), which says: </p>

<blockquote>
  <p>The m.copy() method makes a shallow
  copy of the items contained in a
  mapping object and places them in a
  new mapping object.</p>
</blockquote>

<p>Consider this:</p>

<pre><code>&gt;&gt;&gt; original = dict(a=1, b=2)
&gt;&gt;&gt; new = original.copy()
&gt;&gt;&gt; new.update({'c': 3})
&gt;&gt;&gt; original
{'a': 1, 'b': 2}
&gt;&gt;&gt; new
{'a': 1, 'c': 3, 'b': 2}
</code></pre>

<p>So I assumed this would update the value of <code>original</code> (and add 'c': 3) also since I was doing a shallow copy. Like if you do it for a list:</p>

<pre><code>&gt;&gt;&gt; original = [1, 2, 3]
&gt;&gt;&gt; new = original
&gt;&gt;&gt; new.append(4)
&gt;&gt;&gt; new, original
([1, 2, 3, 4], [1, 2, 3, 4])
</code></pre>

<p>This works as expected.</p>

<p>Since both are shallow copies, why is that the <code>dict.copy()</code> doesn't work as I expect it to? Or my understanding of shallow vs deep copying is flawed?</p>
