New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve the doc and indexing of adict.__missing__. #67195
Comments
Currently, the only index entry for __missing__ is "__missing__() (collections.defaultdict method)". This entry should probably not exist -- see bpo-9536, which inspired this issue. The method is not mentioned in the special-methods doc, and the explanation in the dict doc is not indexed. Two suggestions: https://docs.python.org/3/reference/datamodel.html#emulating-container-types After __getitem__ entry, add automatically indexed entry, something like object.__missing__(self, key): https://docs.python.org/3/library/stdtypes.html#mapping-types-dict Before the d[key] paragraph starting "If a subclass of dict defines a method __missing__()" add explicit __missing__ index directive. The last sentence of the paragraph "See collections.Counter for a complete implementation including other methods helpful for accumulating and managing tallies." is confusing because the linked entry makes no mention of __missing__ (as it should not). Change sentence to something like "There are two stdlib dict subclasses that use (different) __missing__ methods as part of their implementation: collections.Counter and collections.defaultdict." I will work on a patch and try to get the markup correct. |
These edits look reasonable, useful and correct. |
New changeset 0fe3fb886c38 by Terry Jan Reedy in branch '2.7': New changeset 31875b244bdf by Terry Jan Reedy in branch '3.4': New changeset 41b172fd4479 by Terry Jan Reedy in branch '3.4': |
I made a couple more minor revisions to the 3.4 stdtypes text and copied the revised paragraph, with the code example, to 2.7 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: