xiaolizi007
4/27/2017 - 8:28 AM

@property用法

@property #python

class Student(object):

    @property
    def birth(self):
        return self._birth

    @birth.setter
    def birth(self, value):
        self._birth = value

    @property
    def age(self):
        return 2015 - self._birth