class Person:  
    def __init__(self, first_name, last_name):  
        self._first_name = first_name  
        self._last_name = last_name  
  
    @property  
    def full_name(self):  
        """返回完整的姓名"""  
        return f"{self._first_name} {self._last_name}"  
  
    @property  
    def first_name(self):  
        """获取名字"""  
        return self._first_name  
  
    @first_name.setter  
    def first_name(self, value):  
        """设置名字，确保名字不为空"""  
        if not value:  
            raise ValueError("First name cannot be empty")  
        self._first_name = value  
  
    @property  
    def last_name(self):  
        """获取姓氏"""  
        return self._last_name  
  
    @last_name.setter  
    def last_name(self, value):  
        """设置姓氏，确保姓氏不为空"""  
        if not value:  
            raise ValueError("Last name cannot be empty")  
        self._last_name = value  
  
# 创建一个Person对象  
person = Person("John", "Doe")  
  
# 访问full_name属性（实际上是调用了一个方法，但无需加括号）  
print(person.full_name)  # 输出: John Doe  
  
# 访问first_name和last_name属性  
print(person.first_name)  # 输出: John  
print(person.last_name)  # 输出: Doe  
  
# 修改first_name和last_name属性  
person.first_name = "Jane"  
person.last_name = "Smith"  
  
# 再次访问full_name属性，它会自动更新  
print(person.full_name)  # 输出: Jane Smith  
  
# 尝试设置无效的名字（空字符串）将引发ValueError异常  
try:  
    person.first_name = ""  
except ValueError as e:  
    print(e)  # 输出: First name cannot be empty
