]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-35118: Improve docs regarding indexing (GH-10265)
authorWindson yang <wiwindson@outlook.com>
Sun, 4 Nov 2018 22:34:22 +0000 (06:34 +0800)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>
Sun, 4 Nov 2018 22:34:22 +0000 (14:34 -0800)
Doc/library/collections.rst
Doc/library/queue.rst

index 495cfc2c234f75624f51e67ce792093d4be70908..6b9d85abaae726b9139b4e34b1e5c832fdc3b5bd 100644 (file)
@@ -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__()``.
index 1fea86bfc5cd891c8a4b3cae7cc78924a0ae3cdd..f99f6ffb05f69edf687f97d3d01eed22d9c00b1f 100644 (file)
@@ -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.