def date(self):
"""
Getter/setter for the date member.
The setter can take a string or a :meth:`datetime.datetime` and will do the
appropriate transformation.
"""
if self._date:
return self._date
return datetime.datetime.now().strftime('%Y-%m-%d')
python类setter()的实例源码
def publish_timestamp(self):
"""
Getter/setter.
The setter can take an integer (as an epoch timestamp) or a :class:`datetime.datetime`.
instance.
"""
if self._publish_timestamp:
return self._publish_timestamp
return int(time.time())
def type(self):
"""Getter/setter
The setter will verify that the given value is valid.
"""
return self._type