Collection Methods

collections.deque.extend()

Append each input element to the right; a bound may discard older left-side entries.

Formal Syntax & Structure

python syntaxpython
deque_instance.extend(iterable, /)

Parameters & Attributes

NameTypeDescription
iterableiterableInput values, consumed as needed.

Return Value

None

No return value; the operation changes the receiver in place.

Working Example

Example Snippetpython
import collectionsd=collections.deque([1],maxlen=3)d.extend([2,3,4])print(list(d))
Python Reference