@@ -88,27 +88,33 @@ pickle functions from the :mod:`copyreg` module.
8888 single: __deepcopy__() (copy protocol)
8989
9090In order for a class to define its own copy implementation, it can define
91- special methods :meth: `__copy__ ` and :meth: `__deepcopy__ `. The former is called
92- to implement the shallow copy operation; no additional arguments are passed.
93- The latter is called to implement the deep copy operation; it is passed one
94- argument, the ``memo `` dictionary. If the :meth: `__deepcopy__ ` implementation needs
95- to make a deep copy of a component, it should call the :func: `deepcopy ` function
96- with the component as first argument and the memo dictionary as second argument.
97- The memo dictionary should be treated as an opaque object.
91+ special methods :meth: `~object.__copy__ ` and :meth: `~object.__deepcopy__ `.
92+
93+ .. method :: object.__copy__(self)
94+
95+ Called to implement the shallow copy operation;
96+ no additional arguments are passed.
97+
98+ .. method :: object.__deepcopy__(self, memo)
99+
100+ Called to implement the deep copy operation; it is passed one
101+ argument, the *memo * dictionary. If the ``__deepcopy__ `` implementation needs
102+ to make a deep copy of a component, it should call the :func: `deepcopy ` function
103+ with the component as first argument and the *memo * dictionary as second argument.
104+ The *memo * dictionary should be treated as an opaque object.
98105
99106
100107.. index ::
101108 single: __replace__() (replace protocol)
102109
103110Function :func: `replace ` is more limited than :func: `copy ` and :func: `deepcopy `,
104111and only supports named tuples created by :func: `~collections.namedtuple `,
105- :mod: `dataclasses `, and other classes which define method :meth: `! __replace__ `.
112+ :mod: `dataclasses `, and other classes which define method :meth: `~object. __replace__ `.
106113
107- .. method :: __replace__(self, /, **changes)
108- :noindex:
114+ .. method :: object.__replace__(self, /, **changes)
109115
110- :meth: ` !__replace__ ` should create a new object of the same type,
111- replacing fields with values from *changes *.
116+ This method should create a new object of the same type,
117+ replacing fields with values from *changes *.
112118
113119
114120.. seealso ::
0 commit comments