This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kevinjqiu
Recipients kevinjqiu
Date 2015-11-04.04:11:46
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1446610306.98.0.69863764968.issue25549@psf.upfronthosting.co.za>
In-reply-to
Content
Calling sum() on a list of timedelta objects results in TypeError: unsupported operand type(s) for +: 'int' and 'datetime.timedelta'

Here's a script that illustrates this behaviour:  (also attached)

import datetime

x = [datetime.timedelta(1), datetime.timedelta(2)]
print(x[0] + x[1])  # datetime.timedelta(3)
print(sum(x))  # TypeError: unsupported operand type(s) for +: 'int' and 'datetime.timedelta'


The bug is present in all version of Python 2 and Python 3
History
Date User Action Args
2015-11-04 04:11:47kevinjqiusetrecipients: + kevinjqiu
2015-11-04 04:11:46kevinjqiusetmessageid: <1446610306.98.0.69863764968.issue25549@psf.upfronthosting.co.za>
2015-11-04 04:11:46kevinjqiulinkissue25549 messages
2015-11-04 04:11:46kevinjqiucreate