Skip to content

Docs: Improve the copy module documentation - #162818

Open
StanFromIreland wants to merge 2 commits into
python:mainfrom
StanFromIreland:copy-docs
Open

StanFromIreland wants to merge 2 commits into
python:mainfrom
StanFromIreland:copy-docs

Conversation

@StanFromIreland

Copy link
Copy Markdown
Member

@sirosen pointed this out in the docs community Discord. The copy (and pickle and copyreg, but that's left to a follow up) docs are a little messy, and the longer I looked at them the worse they got. ;-) Hence, this is my suggestion to improve it a little.

I reorganised the doc into "Functions", "Shallow and deep copies" and "Customizing copying" sections. I considered following the style we have for sqlite3 or turtle, but I think it would just unnecessarily extend the page. I also add examples for various features.

I found we currently have some odd wording for copy.replace() support across the docs, so I fixed that too.

@read-the-docs-community

read-the-docs-community Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

@rhettinger
rhettinger removed their request for review November 29, 2026 03:41
Comment thread Doc/library/copy.rst Resolved
Comment thread Doc/library/copy.rst
:meth:`~object.__getstate__` and :meth:`~object.__setstate__` methods
customize both pickling and copying.
See the description of module :mod:`pickle` for information on these methods.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this paragraph down and/or give it a dedicated subsection header?

Right now, if you look at the rendered page (not this source), there's not much separation. So you see the doctest above, then this text, and then the following sentence ("In order for a class to support copy.replace ...") all together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants