Say i have a class:
class Foo(object): def __init__(self,d): self.d=d d={\'a\':1,\'b\':2} inst=Foo(d) inst.d Out[315]: {\'a\': 1, \'b\': 2} >
You could do something like this:
class Foo(object): def __init__(self, **kwdargs): self.__dict__.update(kwdargs) d = {'a':1,'b':2} foo = Foo(**d) foo2 = Foo(a=1, b=2)