[Python-Dev] docs - Copy (original) (raw)

Alexander Belopolsky alexander.belopolsky at gmail.com
Fri Jun 25 03:05:09 CEST 2010


On Thu, Jun 24, 2010 at 8:51 PM, Rich Healey <healey.rich at gmail.com> 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....)

If you read the doc excerpt carefully, you will realize that it says the same thing. I agree that the language can be improved, though. There is no need to bring in assignment to explain that a[:] makes a copy of list a. Please create a documentation issue at http://bugs.python.org . If you can suggest a better formulation, it is likely to be accepted.



More information about the Python-Dev mailing list