I'm wondering how I can update an attribute that has been set using the @property decorator in this case. (the code below will tell you more than words...)
When I try to update the email without a setter, I get an AttributeError: can't set attribute. When I do use a setter, nothing changes. The new email doesn't use neither the firstname nor the lastname.
Could anybody help?
class Employee:
def __init__(self, first, last):
self.first = first
self.last = last
@property
def email(self):
return f"{self.first}.{self.last}@email.com".lower()
# @email.setter
# def email(self, new_email):
# return new_email