deque.extend()
deque.extend() is a Python method in the Collections Module category. Extends the right side of the deque by appending elements from iterable. The syntax is deque.extend(iterable). Returns: None. A typical example: d = deque([1]); d.extend([2,3]) # deque([1,2,3]). A close sibling is collections.deque(), which returns a double-ended queue (deque) with efficient O(1) appends/pops from both ends. A close sibling is deque.append(), which adds x to the right side of the deque. A close sibling is deque.appendleft(), which adds x to the left side of the deque. A close sibling is deque.pop(), which removes and returns the rightmost element. Raises IndexError if empty. More about this category: Specialized container datatypes — deque, Counter, defaultdict, namedtuple, OrderedDict. For a broader walkthrough, read the Collections Module guide. Related Collections Module entries: collections.deque(), deque.append(), deque.appendleft(), deque.pop(), deque.popleft(), deque.extendleft(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details.