Kaydet (Commit) 98b85354 authored tarafından Windson yang's avatar Windson yang Kaydeden (comit) Raymond Hettinger

bpo-35118: Improve docs regarding indexing (GH-10265)

üst 55f3317e
...@@ -531,9 +531,9 @@ or subtracting from an empty counter. ...@@ -531,9 +531,9 @@ or subtracting from an empty counter.
In addition to the above, deques support iteration, pickling, ``len(d)``, In addition to the above, deques support iteration, pickling, ``len(d)``,
``reversed(d)``, ``copy.copy(d)``, ``copy.deepcopy(d)``, membership testing with ``reversed(d)``, ``copy.copy(d)``, ``copy.deepcopy(d)``, membership testing with
the :keyword:`in` operator, and subscript references such as ``d[-1]``. Indexed the :keyword:`in` operator, and subscript references such as ``d[0]`` to access
access is O(1) at both ends but slows to O(n) in the middle. For fast random the first element. Indexed access is O(1) at both ends but slows to O(n) in
access, use lists instead. the middle. For fast random access, use lists instead.
Starting in version 3.5, deques support ``__add__()``, ``__mul__()``, Starting in version 3.5, deques support ``__add__()``, ``__mul__()``,
and ``__imul__()``. and ``__imul__()``.
......
...@@ -275,4 +275,5 @@ SimpleQueue Objects ...@@ -275,4 +275,5 @@ SimpleQueue Objects
:class:`collections.deque` is an alternative implementation of unbounded :class:`collections.deque` is an alternative implementation of unbounded
queues with fast atomic :meth:`~collections.deque.append` and 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.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment