Message194181
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. |
|
Date |
User |
Action |
Args |
2013-08-02 15:22:11 | exarkun | set | recipients:
+ exarkun |
2013-08-02 15:22:11 | exarkun | set | messageid: <1375456931.04.0.558889166858.issue18629@psf.upfronthosting.co.za> |
2013-08-02 15:22:10 | exarkun | link | issue18629 messages |
2013-08-02 15:22:10 | exarkun | create | |
|