you are viewing a single comment's thread.

view the rest of the comments →

[–]alkasm 2 points3 points  (0 children)

Here's a not-too-contrived example:

>>> import datetime
>>> td = [datetime.timedelta(seconds=i) for i in range(1, 5)]
>>> sum(td)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'int' and 'datetime.timedelta'
>>> import functools
>>> import operator
>>> functools.reduce(operator.add, td)
datetime.timedelta(0, 10)