diff options
author | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2023-10-19 15:05:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-19 15:05:05 (GMT) |
commit | da991337105e6d87b85a20fdcb386aa140f94d23 (patch) | |
tree | d8be51168734328db76f84c98c5c8adc9902b4bf /Doc/reference | |
parent | d144749914dbe295d71d037e8ca695783511123f (diff) | |
download | cpython-da991337105e6d87b85a20fdcb386aa140f94d23.zip cpython-da991337105e6d87b85a20fdcb386aa140f94d23.tar.gz cpython-da991337105e6d87b85a20fdcb386aa140f94d23.tar.bz2 |
GH-101100: Fix reference warnings for ``__getitem__`` (#110118)
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/compound_stmts.rst | 2 | ||||
-rw-r--r-- | Doc/reference/expressions.rst | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index f79db82..52308f3 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -1058,7 +1058,7 @@ subject value: .. note:: Key-value pairs are matched using the two-argument form of the mapping subject's ``get()`` method. Matched key-value pairs must already be present in the mapping, and not created on-the-fly via :meth:`__missing__` or - :meth:`__getitem__`. + :meth:`~object.__getitem__`. In simple terms ``{KEY1: P1, KEY2: P2, ... }`` matches only if all the following happens: diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 5e9d12c..88d4fca 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -889,7 +889,7 @@ to the index so that, for example, ``x[-1]`` selects the last item of ``x``. The resulting value must be a nonnegative integer less than the number of items in the sequence, and the subscription selects the item whose index is that value (counting from zero). Since the support for negative indices and slicing -occurs in the object's :meth:`__getitem__` method, subclasses overriding +occurs in the object's :meth:`~object.__getitem__` method, subclasses overriding this method will need to explicitly add that support. .. index:: @@ -944,7 +944,7 @@ slice list contains no proper slice). single: step (slice object attribute) The semantics for a slicing are as follows. The primary is indexed (using the -same :meth:`__getitem__` method as +same :meth:`~object.__getitem__` method as normal subscription) with a key that is constructed from the slice list, as follows. If the slice list contains at least one comma, the key is a tuple containing the conversion of the slice items; otherwise, the conversion of the @@ -1670,7 +1670,7 @@ If an exception is raised during the iteration, it is as if :keyword:`in` raised that exception. Lastly, the old-style iteration protocol is tried: if a class defines -:meth:`__getitem__`, ``x in y`` is ``True`` if and only if there is a non-negative +:meth:`~object.__getitem__`, ``x in y`` is ``True`` if and only if there is a non-negative integer index *i* such that ``x is y[i] or x == y[i]``, and no lower integer index raises the :exc:`IndexError` exception. (If any other exception is raised, it is as if :keyword:`in` raised that exception). |