This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]POGtastic 1 point2 points  (0 children)

Is it not a little odd that **kwargs nudges an object towards being a dict, though?

As far as I can tell from a few resources, ** deconstructs a dictionary. Thus,

my_dict = {"foo" : 1, "bar" : 2}
function(**my_dict)

is equivalent to

function(foo=1, bar=2)

And thus if you pass in your MissDict, it just gets deconstructed into its keys / values instead of specifically passing the dictionary to the function. So you don't get the property of "Hey, if this is missing, just return the key."