Alle Dateien aus dem Pythonkurs
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
381 B

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}'")