class empty: def __getattr__(self, attrname): if attrname == "age": return 41 else: raise AttributeError, attrname X = empty() print X.age