diff -r 25d78aa1ec21 Doc/whatsnew/3.5.rst --- a/Doc/whatsnew/3.5.rst Wed May 13 21:44:02 2015 -0700 +++ b/Doc/whatsnew/3.5.rst Thu May 14 02:33:49 2015 -0400 @@ -69,6 +69,7 @@ New syntax features: +* :pep:`448`, additional unpacking generalizations. * :pep:`465`, a new matrix multiplication operator: ``a @ b``. * :pep:`492`, coroutines with async and await syntax. @@ -121,6 +122,36 @@ PEP written by Carl Meyer +PEP 448 - Additional Unpacking Generalizations +-------------------------------------------------------------- + +This PEP proposes extended usages of the * iterable unpacking operator +and ** dictionary unpacking operators to allow unpacking in more positions, +an arbitrary number of times, and in additional circumstances. Specifically, +in function calls, in comprehensions and generator expressions, and in +displays. + + >>> print(*[1], *[2], 3) + 1 2 3 + >>> dict(**{'x': 1}, y=2, **{'z': 3}) + {'x': 1, 'y': 2, 'z': 3} + >>> *range(4), 4 + (0, 1, 2, 3, 4) + >>> [*range(4), 4] + [0, 1, 2, 3, 4] + >>> {*range(4), 4} + {0, 1, 2, 3, 4} + >>> {'x': 1, **{'y': 2}} + {'x': 1, 'y': 2} + >>> {'x': 1, **{'x': 2}} + {'x': 2} + >>> {**{'x': 2}, 'x': 1} + {'x': 1} + +.. seealso:: + + :pep:`448` -- Additional Unpacking Generalizations + PEP 461 - Adding formatting to bytes and bytearray --------------------------------------------------