class Foo(object): A = 42 def __init__(self): self.B = 10 def __getattr__(self, K): print K # def __getattribute__(self, K): # print K f = Foo() f.A f.B f.C