New submission from Kevin Jing Qiu:
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
--
components: Library (Lib)
files: demo.py
messages: 254038
nosy: kevinjqiu
priority: normal
severity: normal
status: open
title: call sum on list of timedelta throws TypeError
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40938/demo.py
___
Python tracker
<http://bugs.python.org/issue25549>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com