Lines Matching full:copy
1 :mod:`copy` --- Shallow and deep copy operations
4 .. module:: copy
5 :synopsis: Shallow and deep copy operations.
7 Assignment statements in Python do not copy objects, they create bindings
9 mutable items, a copy is sometimes needed so one can change one copy without
10 changing the other. This module provides generic shallow and deep copy
16 .. function:: copy(x)
18 Return a shallow copy of *x*.
23 Return a deep copy of *x*.
34 * A *shallow copy* constructs a new compound object and then (to the extent
37 * A *deep copy* constructs a new compound object and then, recursively, inserts
40 Two problems often exist with deep copy operations that don't exist with shallow
41 copy operations:
46 * Because deep copy copies everything it may copy too much, such as data
57 This module does not copy types like module, method, stack trace, stack frame,
58 file, socket, window, array, or any similar types. It does "copy" functions and
62 Shallow copies of dictionaries can be made using :meth:`dict.copy`, and
73 methods. The :mod:`copy` module does not use the :mod:`copy_reg` registration
77 single: __copy__() (copy protocol)
78 single: __deepcopy__() (copy protocol)
80 In order for a class to define its own copy implementation, it can define
82 to implement the shallow copy operation; no additional arguments are passed.
83 The latter is called to implement the deep copy operation; it is passed one
85 to make a deep copy of a component, it should call the :func:`deepcopy` function