Python属性包装器
@property
def year(self):
return self._year;
@year.setter
def year(self, y):
self._year = y
Python工厂函数
@classmethod
def today(cls):
t = time.localtime()
return cls(t.tm_year, t.tm_mon, t.tm_mday)
Python获取所有属性
print cat.__dict__