[Tutor] A slight bug in IDLE
Jim Mooney
cybervigilante at gmail.com
Sat Jul 13 08:14:02 CEST 2013
Here's an odd one.
If I run IDLE, which I thought was pretty reliable, and do this:
from __future__ import division
Then save the file and run the shell from IDLE, __future__ division fails.
But if I then import __future__ division from the shell, it works.
Also, if I print(5/3) from IDLE or assign 5/3 to a variable name,
__future__ division then works okay
I tried this with two other editors and they all failed like that, so
they must be based on IDLE.
This run is After I run the import from IDLE, which fails to register
in the shell unless I assign a division to a variable or print it.
Python 2.7.3 | 32-bit | (default, Jun 14 2013, 18:15:12) [MSC v.1500
32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
>>> 5/3
1
>>> from __future__ import division
>>> 5/3
1.6666666666666667
>>>
By the way, why can't I just import __future__ ? That doesn't work. It
always has to be from __future__
--
Jim
More information about the Tutor
mailing list