Lines Matching full:copy
1 :mod:`!copy` --- Shallow and deep copy operations
4 .. module:: copy
5 :synopsis: Shallow and deep copy operations.
7 **Source code:** :source:`Lib/copy.py`
11 Assignment statements in Python do not copy objects, they create bindings
13 mutable items, a copy is sometimes needed so one can change one copy without
14 changing the other. This module provides generic shallow and deep copy
20 .. function:: copy(obj)
22 Return a shallow copy of *obj*.
27 Return a deep copy of *obj*.
47 * A *shallow copy* constructs a new compound object and then (to the extent
50 * A *deep copy* constructs a new compound object and then, recursively, inserts
53 Two problems often exist with deep copy operations that don't exist with shallow
54 copy operations:
59 * Because deep copy copies everything it may copy too much, such as data
70 This module does not copy types like module, method, stack trace, stack frame,
71 file, socket, window, or any similar types. It does "copy" functions and
75 Shallow copies of dictionaries can be made using :meth:`dict.copy`, and
83 methods. In fact, the :mod:`copy` module uses the registered
87 single: __copy__() (copy protocol)
88 single: __deepcopy__() (copy protocol)
92 In order for a class to define its own copy implementation, it can define
98 Called to implement the shallow copy operation;
104 Called to implement the deep copy operation; it is passed one
106 to make a deep copy of a component, it should call the :func:`~copy.deepcopy` function
114 Function :func:`!copy.replace` is more limited
115 than :func:`~copy.copy` and :func:`~copy.deepcopy`,