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

lotr py lotrpy at gmail.com
Wed May 14 22:35:17 MDT 2008


thanks for the reply,
"from __future__ import division; print 843 / 6917" does work.
On Thu, May 15, 2008 at 9:41 AM, Wingware Support <support at wingware.com>
wrote:

> 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.
>
> Thanks,
>
> --
>
> Stephan Deibel
> Wingware | Python IDE
> Advancing Software Development
>
> www.wingware.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/wingide-users/attachments/20080515/c88648c6/attachment.html


More information about the wingide-users mailing list