Skip to content

Hide "object" prefix on dunders in contextlib docs & selectivly link some more#145436

Merged
hugovk merged 2 commits intopython:mainfrom
CAM-Gerlach:doc-contextlib-object-dunders
Mar 2, 2026
Merged

Hide "object" prefix on dunders in contextlib docs & selectivly link some more#145436
hugovk merged 2 commits intopython:mainfrom
CAM-Gerlach:doc-contextlib-object-dunders

Conversation

@CAM-Gerlach
Copy link
Member

@CAM-Gerlach CAM-Gerlach commented Mar 2, 2026

Per the "underline links" discussion on Discourse and my comment there, this PR adds the ~ operator to a number of object.__dunder__ xrefs in the contextlib docs that are missing it, so that object is no longer repeated over and over doubling the length of each link and looking much more repetitive and distracting. The fact that the dunders are documented on object is mostly an implementation detail in this context and distracts rather than add clarity here. Furthermore, the fact that they are linked makes it generally less vital to fully qualify names in the text referring to them, since that information is encoded in the link.

Additionally, I've also selectively added xref links to a handful of other instances of these dunders elsewhere in this doc, where there wasn't already a linked reference anywhere nearby.


📚 Documentation preview 📚: https://cpython-previews--145436.org.readthedocs.build/

@CAM-Gerlach CAM-Gerlach requested review from hugovk and nedbat March 2, 2026 18:23
@CAM-Gerlach CAM-Gerlach self-assigned this Mar 2, 2026
@CAM-Gerlach CAM-Gerlach added docs Documentation in the Doc dir skip issue skip news needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes labels Mar 2, 2026
@github-project-automation github-project-automation bot moved this to Todo in Docs PRs Mar 2, 2026
@CAM-Gerlach CAM-Gerlach removed their assignment Mar 2, 2026
@nedbat
Copy link
Member

nedbat commented Mar 2, 2026

I wonder if this is something linklint could do for us.

@hugovk hugovk merged commit 9124bc1 into python:main Mar 2, 2026
45 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Mar 2, 2026
@miss-islington-app
Copy link

Thanks @CAM-Gerlach for the PR, and @hugovk for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 2, 2026
…some more (pythonGH-145436)

(cherry picked from commit 9124bc1)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 2, 2026
…some more (pythonGH-145436)

(cherry picked from commit 9124bc1)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
@bedevere-app
Copy link

bedevere-app bot commented Mar 2, 2026

GH-145443 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Mar 2, 2026
@bedevere-app
Copy link

bedevere-app bot commented Mar 2, 2026

GH-145444 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Mar 2, 2026
hugovk pushed a commit that referenced this pull request Mar 2, 2026
…y link some more (GH-145436) (#145443)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
hugovk pushed a commit that referenced this pull request Mar 2, 2026
…y link some more (GH-145436) (#145444)

Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation in the Doc dir skip issue skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants