FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-83448: Fix dict's __missing__ documentation by bharel · Pull Request #17911 · python/cpython · GitHub

Repository navigation

gh-83448: Fix dict's __missing__ documentation - #17911

Closed
bharel wants to merge 8 commits into
python:mainfrom
bharel:fix-dict-get-docs
Closed

bharel wants to merge 8 commits into
python:mainfrom
bharel:fix-dict-get-docs

Conversation

bharel commented Jan 9, 2020 •
edited by AlexWaygood
Loading

Copy link
Copy Markdown
Contributor

According to the mailing list discussion, fixed dict's documentation to account for get() not calling __missing__ and moved __missing__ from the data model to dict as it's a dict-only method and not part of the Mapping ABC.

bharel commented Feb 21, 2020

Copy link
Copy Markdown
Contributor Author

bump

csabella requested a review from terryjreedy May 23, 2020 18:31

terryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

My first thought is that the entry should stay where it is, though something may need to be added somewhere. Special method should not have to be part of an ABC to be documented in the special methods doc. This section long predated ABCs. I will have to look at the linked discussion when I have more time. So I don't know what change, if any, to suggest at the moment.

bharel commented May 24, 2020

Copy link
Copy Markdown
Contributor Author

Special method should not have to be part of an ABC to be documented in the special methods doc.

Thing is, I'm not implying any opinion on whether it should be there or not.
What I I'm saying, is that it should be consistent.

At the moment, you have __reduce__ in pickle's docs, __subclasshook__ in abc's docs, and other dunders at their appropriate or relevant places. You don't have all dunders in the same location, apart from those relevant to all objects and classes.

Continuing with that logic, __missing__ should probably be in dict's docs, as that's the only location where it's relevant. Otherwise the documentation is inconsistent.

Furthermore - it's specifically dict.__missing__, not object.__missing__. The docs are misleading in the current state. (Discussion @ mailing list)

As a side note, the PR changes dict.get documentation as well.

AlexWaygood changed the title bpo-39267: Fix dict's __missing__ documentation gh-83448: Fix dict's __missing__ documentation Oct 30, 2022

slateny commented Dec 10, 2022

Copy link
Copy Markdown
Contributor

Per Guido on the mailing list, maybe @rhettinger can suggest something (seeing that you reviewed/merged #17910 as well).

Comment thread Doc/library/stdtypes.rst

.. method:: __missing__(key)

Not implemented by default. Called by :class:`dict`\ .\ :meth:`__getitem__`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
Not implemented by default. Called by :class:`dict`\ .\ :meth:`__getitem__`
Not implemented by default. Called by :meth:`dict.__getitem__`

merwok commented Mar 1, 2024

Copy link
Copy Markdown
Member

I agree about not moving the entry.
Other magic methods are also documented as object.__iter__ and so on. In this context it means «some object», not «the object type». Improving that would be a separate issue.

github-actions Bot commented Apr 7, 2026

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 7, 2026

Copy link
Copy Markdown
Member

Closing as stale, the requested changes have not been applied in six years.

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

Labels

awaiting changes docs Documentation in the Doc dir skip news stale Stale PR or inactive for long period of time.

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

9 participants


Back | FazBrowse Home | New Git URL