[PyKDE] Eric: interactive shell does not recognize
"from __future__ import division"
Parzival Herzog
parzp at shaw.ca
Thu Sep 30 20:45:55 BST 2004
I'm using eric-snapshot-20040912
I can't get true division to work in the eric3 interactive shell.
Here's a transcript:
-----------------------------------------------------
Python 2.3 (No.2, Aug 31 2003, 17:27:29)
[GCC 3.3.1 (Mandrake Linux 9.2 3.3.1-1mdk)] on lobsang.wp.shawcable.net,
Qt-Version
>>> 3/5
0
>>> import operator
>>> operator.div(3,5)
0
>>> operator.truediv(3,5)
0.59999999999999998
>>> from __future__ import division
>>> 3/5
0
>>>
----------------------------------------------------
Here is the same thing at an interactive terminal:
----------------------------------------------------
[parz at lobsang src]$ python
Python 2.3 (#2, Aug 31 2003, 17:27:29)
[GCC 3.3.1 (Mandrake Linux 9.2 3.3.1-1mdk)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 3/5
0
>>> import operator
>>> operator.div(3,5)
0
>>> operator.truediv(3,5)
0.59999999999999998
>>> from __future__ import division
>>> 3/5
0.59999999999999998
>>>
----------------------------------------------------
I've also tried this with PyCrust (wxWidgets interactive shell), and Idle,
and they all show true division result for 3/5 == 0.6 after the __future__
import.
So something is not right with the eric3 shell. I don't know if this is only
the case for true division, or if it is generally the case for __future__
imports.
--
Parzival Herzog
More information about the PyQt
mailing list