gh-134559: Expand and reorganise documentation for the copy module#134695
Open
ferdnyc wants to merge 3 commits intopython:mainfrom
Open
gh-134559: Expand and reorganise documentation for the copy module#134695ferdnyc wants to merge 3 commits intopython:mainfrom
copy module#134695ferdnyc wants to merge 3 commits intopython:mainfrom
Conversation
The documentation for the copy module was showing its age. Reorganize with additional headings and more uniform structure. Fixes: python#134559
AA-Turner
reviewed
May 26, 2025
Comment on lines
+36
to
+37
| The difference between shallow and deep copying is only relevant for compound | ||
| objects (objects that contain other objects, like lists or class instances): |
Member
There was a problem hiding this comment.
'container' is more commonly used and the name of a collections ABC
Suggested change
| The difference between shallow and deep copying is only relevant for compound | |
| objects (objects that contain other objects, like lists or class instances): | |
| The difference between shallow and deep copying is only relevant for container | |
| objects; those that contain other objects, like lists or class instances: |
AA-Turner
reviewed
May 26, 2025
Comment on lines
+117
to
+118
| ``replace`` | ||
| ----------- |
Member
There was a problem hiding this comment.
Suggested change
| ``replace`` | |
| ----------- | |
| :func:`!replace()` | |
| ------------------ |
AA-Turner
reviewed
May 26, 2025
Comment on lines
+125
to
+129
| 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 implement the replace protocol | ||
| (i.e. define a method :meth:`~object.__replace__`). |
Member
There was a problem hiding this comment.
Suggested change
| 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 implement the replace protocol | |
| (i.e. define a method :meth:`~object.__replace__`). | |
| The :func:`!replace` function is more limited than | |
| :func:`~copy.copy` and :func:`~copy.deepcopy`. | |
| For example, it only supports named tuples created by :func:`~collections.namedtuple`, | |
| :mod:`dataclasses`, and other classes which implement the replace protocol | |
| (i.e. those defining a :meth:`~object.__replace__` method). |
copy module
Yzi-Li
reviewed
May 26, 2025
Comment on lines
+19
to
+20
| ``copy`` and ``deepcopy`` | ||
| ------------------------- |
Contributor
There was a problem hiding this comment.
Suggested change
| ``copy`` and ``deepcopy`` | |
| ------------------------- | |
| :func:`!copy()` and :func:`!deepcopy()` | |
| --------------------------------------- |
| than :func:`~copy.copy` and :func:`~copy.deepcopy`, | ||
| and only supports named tuples created by :func:`~collections.namedtuple`, | ||
| :mod:`dataclasses`, and other classes which implement the replace protocol | ||
| (i.e. define a method :meth:`~object.__replace__`). |
Contributor
There was a problem hiding this comment.
Suggested change
| (i.e. define a method :meth:`~object.__replace__`). | |
| (that is, those defining a :meth:`~object.__replace__` method). |
|
This PR is stale because it has been open for 30 days with no activity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The documentation for the copy module was showing its age. Reorganize with additional headings and more uniform structure.
Fixes: #134559
copymodule #134559