diff options
Diffstat (limited to 'Doc/lib/libcollections.tex')
-rw-r--r-- | Doc/lib/libcollections.tex | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/Doc/lib/libcollections.tex b/Doc/lib/libcollections.tex index 2793095..14e3bf5 100644 --- a/Doc/lib/libcollections.tex +++ b/Doc/lib/libcollections.tex @@ -54,11 +54,6 @@ Deque objects support the following methods: reversing the order of elements in the iterable argument. \end{methoddesc} -\begin{methoddesc}{left}{} - Return leftmost element from the deque. - If no elements are present, raises a \exception{IndexError}. -\end{methoddesc} - \begin{methoddesc}{pop}{} Remove and return an element from the right side of the deque. If no elements are present, raises a \exception{IndexError}. @@ -69,11 +64,6 @@ Deque objects support the following methods: If no elements are present, raises a \exception{IndexError}. \end{methoddesc} -\begin{methoddesc}{right}{} - Return the rightmost element from the deque. - If no elements are present, raises a \exception{IndexError}. -\end{methoddesc} - \begin{methoddesc}{rotate}{n} Rotate the deque \var{n} steps to the right. If \var{n} is negative, rotate to the left. Rotating one step to the right @@ -81,8 +71,9 @@ Deque objects support the following methods: \end{methoddesc} In addition to the above, deques support iteration, pickling, \samp{len(d)}, -\samp{reversed(d)}, \samp{copy.copy(d)}, \samp{copy.deepcopy(d)}, and -membership testing with the \keyword{in} operator. +\samp{reversed(d)}, \samp{copy.copy(d)}, \samp{copy.deepcopy(d)}, +membership testing with the \keyword{in} operator, and subscript references +such as \samp{d[-1]}. Example: @@ -106,11 +97,11 @@ deque(['f', 'g', 'h', 'i', 'j']) 'f' >>> list(d) # list the contents of the deque ['g', 'h', 'i'] - ->>> d.left() # peek at leftmost item +>>> d[0] # peek at leftmost item 'g' ->>> d.right() # peek at rightmost item +>>> d[-1] # peek at rightmost item 'i' + >>> list(reversed(d)) # list the contents of a deque in reverse ['i', 'h', 'g'] >>> 'h' in d # search the deque |