-
-
Notifications
You must be signed in to change notification settings - Fork 33k
GH-138465: Improve documentation for common sequence methods #138474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
2fba2ed
f35df32
700c166
7fd652d
7d6f0fd
170c84e
2619d29
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3117,7 +3117,7 @@ | |
Emulating container types | ||
------------------------- | ||
|
||
The following methods can be defined to implement container objects. None of them | ||
are provided by the :class:`object` class itself. Containers usually are | ||
:term:`sequences <sequence>` (such as :class:`lists <list>` or | ||
:class:`tuples <tuple>`) or :term:`mappings <mapping>` (like | ||
|
@@ -3135,11 +3135,12 @@ | |
: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:`!append`, :meth:`!count`, | ||
:meth:`!index`, :meth:`!extend`, :meth:`!insert`, :meth:`!pop`, :meth:`!remove`, | ||
:meth:`!reverse` and :meth:`!sort`, like Python standard :class:`list` | ||
objects. Finally, | ||
sequence types should implement addition (meaning concatenation) and | ||
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`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is unchanged text (the only difference is fixed cross-references). Please could we leave it to a different issue to change, if needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opened #138562 |
||
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__` | ||
|
Uh oh!
There was an error while loading. Please reload this page.