This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Aaron Hall
Recipients Aaron Hall, brandtbucher, gvanrossum, josh.r, mark.dickinson, rhettinger, scoder, serhiy.storchaka, slam, xtreak
Date 2019-12-12.21:16:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1576185405.71.0.338354888482.issue36144@roundup.psfhosted.org>
In-reply-to
Content
Another obvious way to do it, but I'm +1 on it.

A small side point however - PEP 584 reads:

> To create a new dict containing the merged items of two (or more) dicts, one can currently write:

> {**d1, **d2}

> but this is neither obvious nor easily discoverable. It is only guaranteed to work if the keys are all strings. If the keys are not strings, it currently works in CPython, but it may not work with other implementations, or future versions of CPython[2].

...

> [2] Non-string keys: https://bugs.python.org/issue35105 and https://mail.python.org/pipermail/python-dev/2018-October/155435.html

The references cited does not back this assertion up. Perhaps the intent is to reference the "cool/weird hack" dict(d1, **d2) (see https://mail.python.org/pipermail/python-dev/2010-April/099485.html and https://mail.python.org/pipermail/python-dev/2010-April/099459.html), which allowed any hashable keys in Python 2 but only strings in Python 3.

If I see {**d1, **d2}, my expectations are that this is the new generalized unpacking and I currently expect any keys to be allowed, and the PEP should be updated to accurately reflect this to prevent future misunderstandings.
History
Date User Action Args
2019-12-12 21:16:45Aaron Hallsetrecipients: + Aaron Hall, gvanrossum, rhettinger, mark.dickinson, scoder, serhiy.storchaka, josh.r, slam, xtreak, brandtbucher
2019-12-12 21:16:45Aaron Hallsetmessageid: <1576185405.71.0.338354888482.issue36144@roundup.psfhosted.org>
2019-12-12 21:16:45Aaron Halllinkissue36144 messages
2019-12-12 21:16:45Aaron Hallcreate