Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1ce853f

Browse files
andresdelfinoserhiy-storchaka
authored andcommitted
Move __missing__ after __delitem__ in Data model. (GH-10923)
1 parent 54fd455 commit 1ce853f

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Doc/reference/datamodel.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2146,6 +2146,8 @@ through the container; for mappings, :meth:`__iter__` should be the same as
21462146
.. versionadded:: 3.4
21472147

21482148

2149+
.. index:: object: slice
2150+
21492151
.. note::
21502152

21512153
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
21612163

21622164
.. method:: object.__getitem__(self, key)
21632165

2164-
.. index:: object: slice
2165-
21662166
Called to implement evaluation of ``self[key]``. For sequence types, the
21672167
accepted keys should be integers and slice objects. Note that the special
21682168
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
21782178
indexes to allow proper detection of the end of the sequence.
21792179

21802180

2181-
.. method:: object.__missing__(self, key)
2182-
2183-
Called by :class:`dict`\ .\ :meth:`__getitem__` to implement ``self[key]`` for dict subclasses
2184-
when key is not in the dictionary.
2185-
2186-
21872181
.. method:: object.__setitem__(self, key, value)
21882182

21892183
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
22022196
values as for the :meth:`__getitem__` method.
22032197

22042198

2199+
.. method:: object.__missing__(self, key)
2200+
2201+
Called by :class:`dict`\ .\ :meth:`__getitem__` to implement ``self[key]`` for dict subclasses
2202+
when key is not in the dictionary.
2203+
2204+
22052205
.. method:: object.__iter__(self)
22062206

22072207
This method is called when an iterator is required for a container. This method

0 commit comments

Comments
 (0)