]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] GH-138562: Remove ``sort()`` from the common sequence methods in the data...
authorStan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Mon, 1 Dec 2025 22:29:13 +0000 (22:29 +0000)
committerGitHub <noreply@github.com>
Mon, 1 Dec 2025 22:29:13 +0000 (23:29 +0100)
(cherry picked from commit d0c9943869bb143df445229444224930330ac0f3)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Doc/reference/datamodel.rst

index 0d6e02d3881acbb1e4fc55ecb0d52a2c3090cb33..0ffc83357900828d267c4bd0d8d4f6b2be53c38e 100644 (file)
@@ -3088,17 +3088,20 @@ objects.  The :mod:`collections.abc` module provides a
 :term:`abstract base class` to help create those methods from a base set of
 :meth:`~object.__getitem__`, :meth:`~object.__setitem__`,
 :meth:`~object.__delitem__`, and :meth:`!keys`.
-Mutable sequences should provide methods :meth:`~sequence.append`,
-:meth:`~sequence.count`, :meth:`~sequence.index`, :meth:`~sequence.extend`,
-:meth:`~sequence.insert`, :meth:`~sequence.pop`, :meth:`~sequence.remove`,
-:meth:`~sequence.reverse` and :meth:`~sequence.sort`,
+
+Mutable sequences should provide methods
+:meth:`~sequence.append`, :meth:`~sequence.clear`, :meth:`~sequence.count`,
+:meth:`~sequence.extend`, :meth:`~sequence.index`, :meth:`~sequence.insert`,
+:meth:`~sequence.pop`, :meth:`~sequence.remove`, and :meth:`~sequence.reverse`,
 like Python standard :class:`list` objects.
 Finally, sequence types should implement addition (meaning concatenation) and
 multiplication (meaning repetition) by defining the methods
 :meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object.__iadd__`,
 :meth:`~object.__mul__`, :meth:`~object.__rmul__` and :meth:`~object.__imul__`
 described below; they should not define other numerical
-operators.  It is recommended that both mappings and sequences implement the
+operators.
+
+It is recommended that both mappings and sequences implement the
 :meth:`~object.__contains__` method to allow efficient use of the ``in``
 operator; for
 mappings, ``in`` should search the mapping's keys; for sequences, it should