diff options
author | Andre Delfino <adelfino@gmail.com> | 2018-12-05 19:42:44 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2018-12-05 19:42:44 (GMT) |
commit | 1ce853f37783575e2b3aaa159ddcebc8660830ef (patch) | |
tree | d3c7cb6ce29f10abe600b51837413ca862a44f9a /Doc/reference | |
parent | 54fd45505b3a365e6d53441e6dd7e0d1ec13b46f (diff) | |
download | cpython-1ce853f37783575e2b3aaa159ddcebc8660830ef.zip cpython-1ce853f37783575e2b3aaa159ddcebc8660830ef.tar.gz cpython-1ce853f37783575e2b3aaa159ddcebc8660830ef.tar.bz2 |
Move __missing__ after __delitem__ in Data model. (GH-10923)
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/datamodel.rst | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index 7e2d2e6..b20b708 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -2146,6 +2146,8 @@ through the container; for mappings, :meth:`__iter__` should be the same as .. versionadded:: 3.4 +.. index:: object: slice + .. note:: Slicing is done exclusively with the following three methods. A call like :: @@ -2161,8 +2163,6 @@ through the container; for mappings, :meth:`__iter__` should be the same as .. method:: object.__getitem__(self, key) - .. index:: object: slice - Called to implement evaluation of ``self[key]``. For sequence types, the accepted keys should be integers and slice objects. Note that the special interpretation of negative indexes (if the class wishes to emulate a sequence @@ -2178,12 +2178,6 @@ 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 @@ -2202,6 +2196,12 @@ through the container; for mappings, :meth:`__iter__` should be the same as values as for the :meth:`__getitem__` method. +.. 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.__iter__(self) This method is called when an iterator is required for a container. This method |