@@ -18,26 +18,47 @@ Classes
18
18
appends and pops from either side of the deque. New deques are created
19
19
using the following arguments:
20
20
21
- - *iterable * must be the empty tuple, and the new deque is created empty.
21
+ - *iterable * is an iterable used to populate the deque when it is
22
+ created. It can be an empty tuple or list to create a deque that
23
+ is initially empty.
22
24
23
25
- *maxlen * must be specified and the deque will be bounded to this
24
26
maximum length. Once the deque is full, any new items added will
25
27
discard items from the opposite end.
26
28
27
29
- The optional *flags * can be 1 to check for overflow when adding items.
28
30
29
- As well as supporting `bool ` and `len `, deque objects have the following
30
- methods:
31
+ Deque objects support `bool `, `len `, iteration and subscript load and store.
32
+ They also have the following methods:
31
33
32
34
.. method :: deque.append(x)
33
35
34
36
Add *x * to the right side of the deque.
35
- Raises IndexError if overflow checking is enabled and there is no more room left.
37
+ Raises ``IndexError `` if overflow checking is enabled and there is
38
+ no more room in the queue.
39
+
40
+ .. method :: deque.appendleft(x)
41
+
42
+ Add *x * to the left side of the deque.
43
+ Raises ``IndexError `` if overflow checking is enabled and there is
44
+ no more room in the queue.
45
+
46
+ .. method :: deque.pop()
47
+
48
+ Remove and return an item from the right side of the deque.
49
+ Raises ``IndexError `` if no items are present.
36
50
37
51
.. method :: deque.popleft()
38
52
39
53
Remove and return an item from the left side of the deque.
40
- Raises IndexError if no items are present.
54
+ Raises ``IndexError `` if no items are present.
55
+
56
+ .. method :: deque.extend(iterable)
57
+
58
+ Extend the deque by appending all the items from *iterable * to
59
+ the right of the deque.
60
+ Raises ``IndexError `` if overflow checking is enabled and there is
61
+ no more room in the deque.
41
62
42
63
.. function :: namedtuple(name, fields)
43
64
0 commit comments