class test(object): _informations = {'a':'test'} def __getattr__(self, name): if "name" in self._informations: return self._informations[name] else: # WHAT HAVE I GOT TO WRITE HERE? t = test() print t.a # should be result in output 'test' print t # results in 'NoneType' Exception when else part is missing