Timeline for How do I merge two dictionaries in a single expression in Python?
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 3, 2020 at 21:16 | history | edited | Bilal Syed Hussain | CC BY-SA 4.0 |
Added new | operator for python 3.9
|
Mar 4, 2015 at 22:24 | comment | added | Carl Meyer |
Guido dislikes dict(x, **y) for the (very good) reason that it relies on y only having keys which are valid keyword argument names (unless you are using CPython 2.7, where the dict constructor cheats). This objection/restriction does not apply to PEP 448, which generalizes the ** unpacking syntax to dict literals. So this solution has the same concision as dict(x, **y) , without the downside.
|
|
Mar 4, 2015 at 11:09 | comment | added | Blackeagle52 |
In what way is this solution better than the dict(x, **y) -solution? As you (@CarlMeyer) mentioned within the note of your own answer (stackoverflow.com/a/39858/2798610) Guido considers that solution illegal.
|
|
Feb 28, 2015 at 1:22 | vote | accept | Carl Meyer | ||
Mar 5, 2015 at 14:52 | |||||
Feb 26, 2015 at 21:27 | history | answered | Bilal Syed Hussain | CC BY-SA 3.0 |