Skip to content

Commit 42e8ea9

Browse files
authored
bpo-32739: Show default value for rotate() (GH-5517)
Manual backport of GH-5485
1 parent 2357cd7 commit 42e8ea9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Doc/library/collections.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,14 @@ counts, but the output will exclude results with counts of zero or less.
311311

312312
.. versionadded:: 2.7
313313

314-
.. method:: rotate(n)
314+
.. method:: rotate(n=1)
315315

316316
Rotate the deque *n* steps to the right. If *n* is negative, rotate to
317-
the left. Rotating one step to the right is equivalent to:
318-
``d.appendleft(d.pop())``.
317+
the left.
318+
319+
When the deque is empty, rotating one step to the right is equivalent to
320+
``d.appendleft(d.pop())``, and rotating one step to the left is
321+
equivalent to ``d.append(d.popleft())``.
319322

320323

321324
Deque objects also provide one read-only attribute:

0 commit comments

Comments
 (0)