MCPcopy Index your code
hub / github.com/RustPython/RustPython / __sub__

Method __sub__

Lib/_pydatetime.py:1223–1231  ·  view source on GitHub ↗

Subtract two dates, or a date and a timedelta.

(self, other)

Source from the content-addressed store, hash-verified

1221 __radd__ = __add__
1222
1223 def __sub__(self, other):
1224 """Subtract two dates, or a date and a timedelta."""
1225 if isinstance(other, timedelta):
1226 return self + timedelta(-other.days)
1227 if isinstance(other, date):
1228 days1 = self.toordinal()
1229 days2 = other.toordinal()
1230 return timedelta(days1 - days2)
1231 return NotImplemented
1232
1233 def weekday(self):
1234 "Return day of the week, where Monday == 0 ... Sunday == 6."

Callers

nothing calls this directly

Calls 3

toordinalMethod · 0.95
isinstanceFunction · 0.85
timedeltaClass · 0.85

Tested by

no test coverage detected