class Name: def __init__(self,vorname,name): self.vorname = vorname self.name = name def __getattr__(self,attr): if attr == 'fullname': return self.vorname + ' ' + self.name elif attr == 'sortname': return self.name + ',' + self.vorname else: raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{attr}'")