https://github.com/python/cpython/commit/ca8ca6bb0f5750ed6a4659c4c70b82cd213a0fe7
commit: ca8ca6bb0f5750ed6a4659c4c70b82cd213a0fe7
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: encukou <[email protected]>
date: 2026-03-11T13:58:03+01:00
summary:

[3.14] gh-145591: Move slicing note to __getitem__ (GH-145606) (GH-145760)

(cherry picked from commit 2114da976c3d85a85283d1a9437bdf8604626be8)

Co-authored-by: Ali Towaiji <[email protected]>

files:
M Doc/reference/datamodel.rst

diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 2587b12918bba0..e085acded936ae 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -3242,21 +3242,6 @@ through the object's keys; for sequences, it should 
iterate through the values.
    .. versionadded:: 3.4
 
 
-.. index:: pair: object; slice
-
-.. note::
-
-   Slicing is done exclusively with the following three methods.  A call like 
::
-
-      a[1:2] = b
-
-   is translated to ::
-
-      a[slice(1, 2, None)] = b
-
-   and so forth.  Missing slice items are always filled in with ``None``.
-
-
 .. method:: object.__getitem__(self, subscript)
 
    Called to implement *subscription*, that is, ``self[subscript]``.
@@ -3279,6 +3264,22 @@ through the object's keys; for sequences, it should 
iterate through the values.
    should raise an :exc:`LookupError` or one of its subclasses
    (:exc:`IndexError` for sequences; :exc:`KeyError` for mappings).
 
+   .. index:: pair: object; slice
+
+   .. note::
+
+      Slicing is handled by :meth:`!__getitem__`, :meth:`~object.__setitem__`,
+      and :meth:`~object.__delitem__`.
+      A call like ::
+
+         a[1:2] = b
+
+      is translated to ::
+
+         a[slice(1, 2, None)] = b
+
+      and so forth. Missing slice items are always filled in with ``None``.
+
    .. note::
 
       The sequence iteration protocol (used, for example, in :keyword:`for`

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to