Author exarkun
Recipients exarkun
Date 2013-08-02.15:22:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1375456931.04.0.558889166858.issue18629@psf.upfronthosting.co.za>
In-reply-to
Content
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
'
0:00:01.500000
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.
History
Date User Action Args
2013-08-02 15:22:11exarkunsetrecipients: + exarkun
2013-08-02 15:22:11exarkunsetmessageid: <1375456931.04.0.558889166858.issue18629@psf.upfronthosting.co.za>
2013-08-02 15:22:10exarkunlinkissue18629 messages
2013-08-02 15:22:10exarkuncreate