[wingide-users] a question of "from __future__ import division"

Wingware Support support at wingware.com
Wed May 14 19:41:38 MDT 2008

lotr py wrote:
> first , the auto completer does'not work very well here, it could't give 
> input hint after "from __future__ im"

Interesting -- Wing seems to be confused by this context although something
like 'from foo im' seems to include 'import'.  Thanks for reporting this.

BTW, it looks like it also fails to find anything after "from __future__
import d".

> second, it look's doesn't work in the debug probe, below is some related 
> input and output:
>  >>> self.model[key][value], total
> (843, 6917)
>  >>> self.model[key][value]/total
> 0
>  >>> from __future__ import division
>  >>> self.model[key][value]/total
> 0
>  >>> self.model[key][value]/float(total)
> 0.12187364464363164

This is due to how 'from __future__' works and how the shell and debug
probe in Wing work.  The 'from __future__' essentially needs to be at
the start of the file and applies only to that context, so it's a bit
tricky to synthesize those.  It's somewhat like doing:

exec "from __future__ import division"
exec "print 843 / 6917"

Instead of this:

exec "from __future__ import division; print 843 / 6917"

Anyway, it's on our list to fix.



Stephan Deibel
Wingware | Python IDE
Advancing Software Development


More information about the wingide-users mailing list