From 59eaef2f78e87d4667117bfae0deee600b3d3a65 Mon Sep 17 00:00:00 2001 From: george Date: Tue, 17 Jun 2014 12:27:44 -0600 Subject: [PATCH] Added pep-3132 style extended unpacking. --- docs/writing/style.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/writing/style.rst b/docs/writing/style.rst index 9ca14896d..2814318f7 100644 --- a/docs/writing/style.rst +++ b/docs/writing/style.rst @@ -293,6 +293,16 @@ Nested unpacking works too: a, (b, c) = 1, (2, 3) +In Python 3, a new method of extended unpacking was introduced by +:pep:`3132`: + +.. code-block:: python + + a, *rest = [1, 2, 3] + # a = 1, rest = [2, 3] + a, *middle, c = [1, 2, 3, 4] + # a = 1, middle = [2, 3], c = 4 + Create an ignored variable ~~~~~~~~~~~~~~~~~~~~~~~~~~