[Python-Dev] docs - Copy (original) (raw)
Rich Healey healey.rich at gmail.com
Fri Jun 25 03:14:39 CEST 2010
- Previous message: [Python-Dev] docs - Copy
- Next message: [Python-Dev] docs - Copy
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Jun 25, 2010 at 11:04 AM, Steve Holden <steve at holdenweb.com> wrote:
Rich Healey wrote:
http://docs.python.org/library/copy.html
Just near the bottom it reads: """Shallow copies of dictionaries can be made using dict.copy(), and of lists by assigning a slice of the entire list, for example, copiedlist = originallist[:]."""
Surely this is a typo? To my understanding, copiedlist = originallist[:] gives you a clean copy (slicing returns a new object....) Yes, but it's a shallow copy: the new object references exactly the same objects as the original list (not copies of those objects). A deep copy would need to copy any referenced lists, and so on.
My apologies guys, I see now.
I will see if I can think of a less ambiguous way to word this and submit a bug.
Thankyou!
- Previous message: [Python-Dev] docs - Copy
- Next message: [Python-Dev] docs - Copy
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]