My class has a dict, for example:
class MyClass(object): def __init__(self): self.data = {\'a\': \'v1\', \'b\': \'v2\'}
Then I
class A(object): def __init__(self): self.data = {'a': 'v1', 'b': 'v2'} def __getattr__(self, attr): try: return self.data[attr] except: return "not found" >>>a = A() >>>print a.a v1 >>>print a.c not found