2👍
✅
You can use the @property
as a decorator.
@property
def name(self):
return self.person.name
Now, you can just reference it as
member.name
instead of member.name()
Now, name
is treated as a property on Member
class, instead of a class method.
Source:stackexchange.com