File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,12 +135,10 @@ \subsection{Recipes \label{deque-recipes}}
135135This section shows various approaches to working with deques.
136136
137137The \method {rotate()} method provides a way to implement \class {deque}
138- slicing and deletion:
139-
140- This pure python implementation of \code {del d[n]} shows how to use the
141- \method {rotate()} method as a building block for implementing a variety
142- of class{deque} operations:
143-
138+ slicing and deletion. For example, a pure python implementation of
139+ \code {del d[n]} relies on the \method {rotate()} method to position
140+ elements to be popped:
141+
144142\begin {verbatim }
145143def delete_nth(d, n):
146144 d.rotate(-n)
@@ -188,9 +186,9 @@ \subsection{Recipes \label{deque-recipes}}
188186
189187
190188Multi-pass data reduction algorithms can be succinctly expressed and
191- efficiently coded by extracting elements using multiple calls to
192- \method {popleft()}, applying the reduction function, and using
193- \method {append()} for adding the result back to the queue.
189+ efficiently coded by extracting elements with multiple calls to
190+ \method {popleft()}, applying the reduction function, and calling
191+ \method {append()} to add the result back to the queue.
194192
195193For example, building a balanced binary tree of nested lists entails
196194reducing two adjacent nodes into one by grouping them in a list:
Original file line number Diff line number Diff line change @@ -476,7 +476,6 @@ \subsection{Recipes \label{itertools-recipes}}
476476 """Returns the sequence elements and then returns None indefinitely.
477477
478478 Useful for emulating the behavior of the built-in map() function.
479-
480479 """
481480 return chain(seq, repeat(None))
482481
@@ -494,7 +493,6 @@ \subsection{Recipes \label{itertools-recipes}}
494493 """Repeat calls to func with specified arguments.
495494
496495 Example: repeatfunc(random.random)
497-
498496 """
499497 if times is None:
500498 return starmap(func, repeat(args))
You can’t perform that action at this time.
0 commit comments