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}
Is there a way to dyamically create n attributes where each attribute would be a dict key, so inst.a would return 1 and so on.
inst.0is illegal syntax.__getitem__and friends.