Tag Archives: summation

summing datetime.timedelta objects in Python

Argh! The following snippet is totally broken: import datetime times = [datetime.timedelta(hours=1), datetime.timedelta(minutes=30)] print sum(times) print min(times) print max(times) It raises “TypeError: unsupported operand type(s) for +: ‘int’ and ‘datetime.timedelta’” The thing is, I want this function to be able … Continue reading

Posted in General | Tagged , , | Leave a comment