diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2023-09-29 08:26:55 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-29 08:26:55 (GMT) |
commit | f1b1680a72cc7eb650f785b9438a3900ca6f695e (patch) | |
tree | 4ef5b2df409ce2dfda0c13557a7fa8beeb1b8890 /Doc | |
parent | d102d39bbe175f179f28e4d4bea99dc122da5f8e (diff) | |
download | cpython-f1b1680a72cc7eb650f785b9438a3900ca6f695e.zip cpython-f1b1680a72cc7eb650f785b9438a3900ca6f695e.tar.gz cpython-f1b1680a72cc7eb650f785b9438a3900ca6f695e.tar.bz2 |
gh-109961: Use proper `module` for `copy` method docs (#110027)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/copy.rst | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Doc/library/copy.rst b/Doc/library/copy.rst index 811b2c5..74333b2 100644 --- a/Doc/library/copy.rst +++ b/Doc/library/copy.rst @@ -87,6 +87,8 @@ pickle functions from the :mod:`copyreg` module. single: __copy__() (copy protocol) single: __deepcopy__() (copy protocol) +.. currentmodule:: None + In order for a class to define its own copy implementation, it can define special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`. @@ -101,7 +103,7 @@ special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`. Called to implement the deep copy operation; it is passed one argument, the *memo* dictionary. If the ``__deepcopy__`` implementation needs - to make a deep copy of a component, it should call the :func:`deepcopy` function + to make a deep copy of a component, it should call the :func:`~copy.deepcopy` function with the component as first argument and the *memo* dictionary as second argument. The *memo* dictionary should be treated as an opaque object. @@ -109,7 +111,8 @@ special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`. .. index:: single: __replace__() (replace protocol) -Function :func:`replace` is more limited than :func:`copy` and :func:`deepcopy`, +Function :func:`!copy.replace` is more limited +than :func:`~copy.copy` and :func:`~copy.deepcopy`, and only supports named tuples created by :func:`~collections.namedtuple`, :mod:`dataclasses`, and other classes which define method :meth:`~object.__replace__`. |