summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-09-09 16:49:13 (GMT)
committerGeorg Brandl <georg@python.org>2009-09-09 16:49:13 (GMT)
commitffdde9e959513e72a7ac649e9c2fc70566778453 (patch)
tree1e333f98d741a2ca084a6a37d99d94ef18f2ad5b
parent93ed82048f3073bfd972a8614adecd2930b29c1f (diff)
downloadcpython-ffdde9e959513e72a7ac649e9c2fc70566778453.zip
cpython-ffdde9e959513e72a7ac649e9c2fc70566778453.tar.gz
cpython-ffdde9e959513e72a7ac649e9c2fc70566778453.tar.bz2
Properly document copy and deepcopy as functions.
-rw-r--r--Doc/library/copy.rst23
1 files changed, 13 insertions, 10 deletions
diff --git a/Doc/library/copy.rst b/Doc/library/copy.rst
index 89b668d..b3ce51f 100644
--- a/Doc/library/copy.rst
+++ b/Doc/library/copy.rst
@@ -1,25 +1,28 @@
-
:mod:`copy` --- Shallow and deep copy operations
================================================
.. module:: copy
:synopsis: Shallow and deep copy operations.
+This module provides generic (shallow and deep) copying operations.
-.. index::
- single: copy() (in copy)
- single: deepcopy() (in copy)
-This module provides generic (shallow and deep) copying operations.
+Interface summary:
+
+.. function:: copy(x)
+
+ Return a shallow copy of *x*.
+
+
+.. function:: deepcopy(x)
+
+ Return a deep copy of *x*.
-Interface summary::
- import copy
+.. exception:: error
- x = copy.copy(y) # make a shallow copy of y
- x = copy.deepcopy(y) # make a deep copy of y
+ 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
objects (objects that contain other objects, like lists or class instances):