mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Issue #23006: Improve the documentation and indexing of dict.__missing__.
Add an entry in the language datamodel special methods section. Revise and index its discussion in the stdtypes mapping/dict section.
This commit is contained in:
parent
60599525c5
commit
b67f6e27e1
3 changed files with 18 additions and 5 deletions
|
|
@ -1904,6 +1904,12 @@ through the container; for mappings, :meth:`__iter__` should be the same as
|
|||
indexes to allow proper detection of the end of the sequence.
|
||||
|
||||
|
||||
.. method:: object.__missing__(self, key)
|
||||
|
||||
Called by :class:`dict`\ .\ :meth:`__getitem__` to implement ``self[key]`` for dict subclasses
|
||||
when key is not in the dictionary.
|
||||
|
||||
|
||||
.. method:: object.__setitem__(self, key, value)
|
||||
|
||||
Called to implement assignment to ``self[key]``. Same note as for
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue