title: Is python deepcopy more efficient than custom code, or less efficient/predictable?
body: <p>I have a dict where the values are non-nested lists (specifically, the keys are ints and the values are lists of ints). I'd like to make a deep copy of it so that I don't modify the lists in the original dict.</p>
  
  <p>I know I can use </p>
  
  <pre><code>copied = copy.deepcopy(original)
  </code></pre>
  
  <p>However since I know the form of the data structure I can also use something like</p>
  
  <pre><code>copied = {key:valuelist[:] for (key,valuelist) in original.iteritems()}
  </code></pre>
  
  <p>Is one of these solutions better? More efficient? Less likely to lead to nasty surprises? </p>
  
  <p>I have been told that deepcopy() comes with some gotchas but I don't really understand what. I would also like to understand whether using deepcopy() is less efficient than my code (maybe because it's a more general solution?) or more efficient (maybe it's optimised at a lower level?).</p>