I\'d like to pass a dict to an object\'s constructor for use as kwargs.
Obviously:
foo = SomeClass(mydict)
Simply passes a single
Use :
foo = SomeClass(**mydict)
this will unpack the dict value and pass them to the function.
For example:
mydict = {'a': 1, 'b': 2} SomeClass(**mydict) # Equivalent to : SomeClass(a=1, b=2)