Merged revisions 74737 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74737 | georg.brandl | 2009-09-09 18:49:13 +0200 (Mi, 09 Sep 2009) | 1 line

  Properly document copy and deepcopy as functions.
........
This commit is contained in:
Georg Brandl 2009-09-09 16:51:05 +00:00
parent 165581cb36
commit a59750f4d6

View File

@ -4,21 +4,25 @@
.. module:: copy .. module:: copy
:synopsis: Shallow and deep copy operations. :synopsis: Shallow and deep copy operations.
.. index::
single: copy() (in copy)
single: deepcopy() (in copy)
This module provides generic (shallow and deep) copying operations. This module provides generic (shallow and deep) copying operations.
Interface summary::
import copy Interface summary:
x = copy.copy(y) # make a shallow copy of y .. function:: copy(x)
x = copy.deepcopy(y) # make a deep copy of y
Return a shallow copy of *x*.
.. function:: deepcopy(x)
Return a deep copy of *x*.
.. exception:: error
Raised for module specific errors.
For module specific errors, :exc:`copy.error` is raised.
The difference between shallow and deep copying is only relevant for compound The difference between shallow and deep copying is only relevant for compound
objects (objects that contain other objects, like lists or class instances): objects (objects that contain other objects, like lists or class instances):