Collection Methods

collections.deque.reverse()

Reverse the order in place without allocating a second deque.

Formal Syntax & Structure

python syntaxpython
deque_instance.reverse()

Return Value

None

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

Working Example

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