The collections module contains high-performance implementations of various container data types. This is a relatively new Python module that only contains a single object as of this writing. However, it may be expanded in future releases.
Creates a double-ended queue (deque) object. iterable is an iterable object used to populate the deque. A deque allows items to be inserted or removed from either end of the queue. The implementation has been optimized so that the performance of these operations is approximately the same (O(1)). This is slightly different from a list where operations at the front of the list may require shifting of all the elements that follow.
An instance, d, of deque has the following methods: ...