Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 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. Commented Mar 4, 2015 at 11:09
  • 18
    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.
    – Carl Meyer
    Commented Mar 4, 2015 at 22:24