Message254038
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 |
|
Date |
User |
Action |
Args |
2015-11-04 04:11:47 | kevinjqiu | set | recipients:
+ kevinjqiu |
2015-11-04 04:11:46 | kevinjqiu | set | messageid: <1446610306.98.0.69863764968.issue25549@psf.upfronthosting.co.za> |
2015-11-04 04:11:46 | kevinjqiu | link | issue25549 messages |
2015-11-04 04:11:46 | kevinjqiu | create | |
|