Skip to content

Commit 59eaef2

Browse files
committed
Added pep-3132 style extended unpacking.
1 parent 63d836e commit 59eaef2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/writing/style.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,16 @@ Nested unpacking works too:
293293
294294
a, (b, c) = 1, (2, 3)
295295
296+
In Python 3, a new method of extended unpacking was introduced by
297+
:pep:`3132`:
298+
299+
.. code-block:: python
300+
301+
a, *rest = [1, 2, 3]
302+
# a = 1, rest = [2, 3]
303+
a, *middle, c = [1, 2, 3, 4]
304+
# a = 1, middle = [2, 3], c = 4
305+
296306
Create an ignored variable
297307
~~~~~~~~~~~~~~~~~~~~~~~~~~
298308

0 commit comments

Comments
 (0)