[Python-checkins] bpo-35118: Improve docs regarding indexing (GH-10265)
Raymond Hettinger
webhook-mailer at python.org
Sun Nov 4 17:34:25 EST 2018
https://github.com/python/cpython/commit/98b85354153883b0a080f678f213729cd0764fee
commit: 98b85354153883b0a080f678f213729cd0764fee
branch: master
author: Windson yang <wiwindson at outlook.com>
committer: Raymond Hettinger <rhettinger at users.noreply.github.com>
date: 2018-11-04T14:34:22-08:00
summary:
bpo-35118: Improve docs regarding indexing (GH-10265)
files:
M Doc/library/collections.rst
M Doc/library/queue.rst
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 495cfc2c234f..6b9d85abaae7 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -531,9 +531,9 @@ or subtracting from an empty counter.
In addition to the above, deques support iteration, pickling, ``len(d)``,
``reversed(d)``, ``copy.copy(d)``, ``copy.deepcopy(d)``, membership testing with
-the :keyword:`in` operator, and subscript references such as ``d[-1]``. Indexed
-access is O(1) at both ends but slows to O(n) in the middle. For fast random
-access, use lists instead.
+the :keyword:`in` operator, and subscript references such as ``d[0]`` to access
+the first element. Indexed access is O(1) at both ends but slows to O(n) in
+the middle. For fast random access, use lists instead.
Starting in version 3.5, deques support ``__add__()``, ``__mul__()``,
and ``__imul__()``.
diff --git a/Doc/library/queue.rst b/Doc/library/queue.rst
index 1fea86bfc5cd..f99f6ffb05f6 100644
--- a/Doc/library/queue.rst
+++ b/Doc/library/queue.rst
@@ -275,4 +275,5 @@ SimpleQueue Objects
:class:`collections.deque` is an alternative implementation of unbounded
queues with fast atomic :meth:`~collections.deque.append` and
- :meth:`~collections.deque.popleft` operations that do not require locking.
+ :meth:`~collections.deque.popleft` operations that do not require locking
+ and also support indexing.
More information about the Python-checkins
mailing list