def __sub__(self, other): if isinstance(other, timedelta): return self.__class__(days=self.days - timedelta_to_days(other)) if isinstance(other, PJDay): return timedelta(days=self.days - other.days)
def __add__(self, other): if not isinstance(other, timedelta): raise TypeError( "unsupported operand type(s) for +: '%s' and '%s'" % (self.__class__, other.__class__)) return self.__class__(days=self.days + timedelta_to_days(other))
def __add__(self, other): if not isinstance(other, timedelta): raise TypeError("unsupported operand type(s) for +: '%s' and '%s'" % (self.__class__, other.__class__)) return self.__class__(days=self.days + timedelta_to_days(other))