diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2014-12-10 23:38:19 (GMT) |
---|---|---|
committer | Terry Jan Reedy <tjreedy@udel.edu> | 2014-12-10 23:38:19 (GMT) |
commit | b67f6e27e11264876e185cacd8ebabbf41c27fb0 (patch) | |
tree | 81a68598278f8028899a53e97f2012ab528c3735 /Doc/reference | |
parent | 60599525c509a962e8fb5897240d42a56c092961 (diff) | |
download | cpython-b67f6e27e11264876e185cacd8ebabbf41c27fb0.zip cpython-b67f6e27e11264876e185cacd8ebabbf41c27fb0.tar.gz cpython-b67f6e27e11264876e185cacd8ebabbf41c27fb0.tar.bz2 |
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.
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/datamodel.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 618c257..d0eede7 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -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 |