diff options
author | Raymond Hettinger <python@rcn.com> | 2004-06-12 07:59:40 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-06-12 07:59:40 (GMT) |
commit | 2e6694086f07d293d1907891f68cec6076d44f73 (patch) | |
tree | b34acf0454a77351410df64eaebc8814960e6119 /Doc/lib/libcollections.tex | |
parent | 34809170e507b690f205732773479baa654578bd (diff) | |
download | cpython-2e6694086f07d293d1907891f68cec6076d44f73.zip cpython-2e6694086f07d293d1907891f68cec6076d44f73.tar.gz cpython-2e6694086f07d293d1907891f68cec6076d44f73.tar.bz2 |
Minor wording and spacing nits.
Diffstat (limited to 'Doc/lib/libcollections.tex')
-rw-r--r-- | Doc/lib/libcollections.tex | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/Doc/lib/libcollections.tex b/Doc/lib/libcollections.tex index c7d5c50..84cc507 100644 --- a/Doc/lib/libcollections.tex +++ b/Doc/lib/libcollections.tex @@ -135,12 +135,10 @@ deque(['c', 'b', 'a']) This section shows various approaches to working with deques. The \method{rotate()} method provides a way to implement \class{deque} -slicing and deletion: - -This pure python implementation of \code{del d[n]} shows how to use the -\method{rotate()} method as a building block for implementing a variety -of class{deque} operations: - +slicing and deletion. For example, a pure python implementation of +\code{del d[n]} relies on the \method{rotate()} method to position +elements to be popped: + \begin{verbatim} def delete_nth(d, n): d.rotate(-n) @@ -188,9 +186,9 @@ h Multi-pass data reduction algorithms can be succinctly expressed and -efficiently coded by extracting elements using multiple calls to -\method{popleft()}, applying the reduction function, and using -\method{append()} for adding the result back to the queue. +efficiently coded by extracting elements with multiple calls to +\method{popleft()}, applying the reduction function, and calling +\method{append()} to add the result back to the queue. For example, building a balanced binary tree of nested lists entails reducing two adjacent nodes into one by grouping them in a list: |