Author exarkun
Recipients exarkun
Date 2013-08-02.15:22:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
datetime.timedelta instances are divisible by integers on Python 2.7, but not when __future__.division has been turned on:

exarkun@top:~$ ~/Projects/cpython/2.7/python -c '
from datetime import timedelta
print timedelta(seconds=3) / 2
exarkun@top:~$ ~/Projects/cpython/2.7/python -c '
from __future__ import division
from datetime import timedelta
print timedelta(seconds=3) / 2
Traceback (most recent call last):
  File "<string>", line 4, in <module>
TypeError: unsupported operand type(s) for /: 'datetime.timedelta' and 'int'
exarkun@top:~$ ~/Projects/cpython/2.7/python
Python 2.7.5+ (2.7:8205e72b5cfc, Aug  2 2013, 11:12:04) 

This presents a minor barrier to Python 3 transitions, since it prevents the use of __future__.division in a module trying to retain Python 2 compatibility where timedelta division is used.
Date User Action Args
2013-08-02 15:22:11exarkunsetrecipients: + exarkun
2013-08-02 15:22:11exarkunsetmessageid: <>
2013-08-02 15:22:10exarkunlinkissue18629 messages
2013-08-02 15:22:10exarkuncreate