diff options
author | Damien George <damien.p.george@gmail.com> | 2018-06-26 14:26:31 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2018-06-26 14:29:22 +1000 |
commit | b9ec6037edf5e6ff6f8f400d70f7351d1b0af67d (patch) | |
tree | cdb9c3d94ad1cf6f34b473cff47123d576917623 | |
parent | 9b158d60e160fd6be2fedc33a7d7327ec755f7b0 (diff) |
docs/library: Add documentation for ucollections.deque.
-rw-r--r-- | docs/library/ucollections.rst | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/library/ucollections.rst b/docs/library/ucollections.rst index 96de67acc..b833842c1 100644 --- a/docs/library/ucollections.rst +++ b/docs/library/ucollections.rst @@ -12,6 +12,33 @@ hold/accumulate various objects. Classes ------- +.. function:: deque(iterable, maxlen[, flags]) + + Deques (double-ended queues) are a list-like container that support O(1) + appends and pops from either side of the deque. New deques are created + using the following arguments: + + - *iterable* must be the empty tuple, and the new deque is created empty. + + - *maxlen* must be specified and the deque will be bounded to this + maximum length. Once the deque is full, any new items added will + discard items from the opposite end. + + - The optional *flags* can be 1 to check for overflow when adding items. + + As well as supporting `bool` and `len`, deque objects have the following + methods: + + .. method:: deque.append(x) + + Add *x* to the right side of the deque. + Raises IndexError if overflow checking is enabled and there is no more room left. + + .. method:: deque.popleft() + + Remove and return an item from the left side of the deque. + Raises IndexError if no items are present. + .. function:: namedtuple(name, fields) This is factory function to create a new namedtuple type with a specific |