[PyKDE] Eric: interactive shell does not recognize "from __future__ import division"

Detlev Offenbach detlev at die-offenbachs.de
Sat Oct 2 12:04:52 BST 2004


Hi,

this is due to the support of Python versions prior to 2.2. A fix that 
respects the __future__ statement will be in the 3.5 release.

Detlev

Am Donnerstag, 30. September 2004 21:45 schrieb Parzival Herzog:
> 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.

-- 
Detlev Offenbach
detlev at die-offenbachs.de




More information about the PyQt mailing list