views:

1495

answers:

1
+5  A: 

The documentation makes it pretty clear that you're getting new copies, not references. Deepcopy creates deep copies for built in types, with various exceptions and that you can add custom copy operations to your user-defined objects to get deep copy support for them as well. If you're not sure, well that's what unit testing is for.

apphacker
I dont think it states built in types, it states that it does “copy” the pickable objects... Does that mean I would get a new list reference?
mandel
Deepcopy has a short list of exceptions. Everything else is copied."This module does not copy types like module, method, stack trace, stack frame, file, socket, window, array, or any similar types." You get a new list. Not a reference to the list but a new list. Print the two dictionaries from your example and look at them.
S.Lott