diff options
author | Yury Selivanov <yselivanov@sprymix.com> | 2015-08-04 16:42:20 (GMT) |
---|---|---|
committer | Yury Selivanov <yselivanov@sprymix.com> | 2015-08-04 16:42:20 (GMT) |
commit | 216d999345e4c9aa7a387408d41a57a922b60bca (patch) | |
tree | 9c194526c3c8b45b7abe69a3290df96129c57f82 /Doc | |
parent | 1f9a29f31b8e21997310206fd88d7ad0ca74c4f5 (diff) | |
download | cpython-216d999345e4c9aa7a387408d41a57a922b60bca.zip cpython-216d999345e4c9aa7a387408d41a57a922b60bca.tar.gz cpython-216d999345e4c9aa7a387408d41a57a922b60bca.tar.bz2 |
whatsnew/3.5: Mention PEP 448
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/whatsnew/3.5.rst | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst index e7992d9..2c74afe 100644 --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -203,6 +203,49 @@ called ``@``. (Mnemonic: ``@`` is ``*`` for mATrices.) :pep:`465` -- A dedicated infix operator for matrix multiplication +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. + +Function calls are proposed to support an arbitrary number of +unpackings rather than just one:: + + >>> print(*[1], *[2], 3) + 1 2 3 + >>> dict(**{'x': 1}, y=2, **{'z': 3}) + {'x': 1, 'y': 2, 'z': 3} + +Unpacking is proposed to be allowed inside tuple, list, set, +and dictionary displays:: + + >>> *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} + +In dictionaries, later values will always override earlier ones:: + + >>> {'x': 1, **{'x': 2}} + {'x': 2} + + >>> {**{'x': 2}, 'x': 1} + {'x': 1} + +.. seealso:: + + :pep:`448` -- Additional Unpacking Generalizations + + PEP 471 - os.scandir() function -- a better and faster directory iterator ------------------------------------------------------------------------- |