def __sub__(self, other):
if self and isinstance(other, (Time, datetime.time)):
t = self._time
t = datetime.datetime(2012, 6, 27, t.hour, t.minute, t.second, t.microsecond)
o = datetime.datetime(2012, 6, 27, other.hour, other.minute, other.second, other.microsecond)
return t - o
elif self and isinstance(other, (datetime.timedelta)):
t = self._time
t = datetime.datetime(2012, 6, 27, t.hour, t.minute, t.second, t.microsecond)
t -= other
return Time(t.hour, t.minute, t.second, t.microsecond)
else:
return NotImplemented
评论列表
文章目录