MCPcopy Index your code
hub / github.com/python/cpython / __add__

Method __add__

Lib/_pydatetime.py:1227–1234  ·  view source on GitHub ↗

Add a date to a timedelta.

(self, other)

Source from the content-addressed store, hash-verified

1225 # Computations
1226
1227 def __add__(self, other):
1228 "Add a date to a timedelta."
1229 if isinstance(other, timedelta):
1230 o = self.toordinal() + other.days
1231 if 0 < o <= _MAXORDINAL:
1232 return type(self).fromordinal(o)
1233 raise OverflowError("result out of range")
1234 return NotImplemented
1235
1236 __radd__ = __add__
1237

Callers

nothing calls this directly

Calls 2

toordinalMethod · 0.95
fromordinalMethod · 0.80

Tested by

no test coverage detected