Skip to content

Commit 298fbc9

Browse files
AA-Turnermiss-islington
authored andcommitted
pythonGH-138562: Remove sort() from the common sequence methods in the data model (pythonGH-138563)
(cherry picked from commit d0c9943) Co-authored-by: Adam Turner <[email protected]>
1 parent a963843 commit 298fbc9

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Doc/reference/datamodel.rst

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3140,17 +3140,20 @@ objects. The :mod:`collections.abc` module provides a
31403140
:term:`abstract base class` to help create those methods from a base set of
31413141
:meth:`~object.__getitem__`, :meth:`~object.__setitem__`,
31423142
:meth:`~object.__delitem__`, and :meth:`!keys`.
3143-
Mutable sequences should provide methods :meth:`~sequence.append`,
3144-
:meth:`~sequence.count`, :meth:`~sequence.index`, :meth:`~sequence.extend`,
3145-
:meth:`~sequence.insert`, :meth:`~sequence.pop`, :meth:`~sequence.remove`,
3146-
:meth:`~sequence.reverse` and :meth:`!sort`,
3143+
3144+
Mutable sequences should provide methods
3145+
:meth:`~sequence.append`, :meth:`~sequence.clear`, :meth:`~sequence.count`,
3146+
:meth:`~sequence.extend`, :meth:`~sequence.index`, :meth:`~sequence.insert`,
3147+
:meth:`~sequence.pop`, :meth:`~sequence.remove`, and :meth:`~sequence.reverse`,
31473148
like Python standard :class:`list` objects.
31483149
Finally, sequence types should implement addition (meaning concatenation) and
31493150
multiplication (meaning repetition) by defining the methods
31503151
:meth:`~object.__add__`, :meth:`~object.__radd__`, :meth:`~object.__iadd__`,
31513152
:meth:`~object.__mul__`, :meth:`~object.__rmul__` and :meth:`~object.__imul__`
31523153
described below; they should not define other numerical
3153-
operators. It is recommended that both mappings and sequences implement the
3154+
operators.
3155+
3156+
It is recommended that both mappings and sequences implement the
31543157
:meth:`~object.__contains__` method to allow efficient use of the ``in``
31553158
operator; for
31563159
mappings, ``in`` should search the mapping's keys; for sequences, it should

0 commit comments

Comments
 (0)