newbie division question

David Isaac aisaac0 at verizon.net
Mon Sep 18 15:54:20 EDT 2006


> Alan Isaac wrote:
> > Suppose x and y are ints in moduleA.
> >
> > If I put
> > from __future__ import division
> > in moduleA then x/y will produce the truediv result.
> >
> > If I put
> > from __future__ import division
> > in moduleB
> > and
> > from moduleB import *
> > in module A
> > then x/y will NOT produce the truediv result
> > (in moduleA).

<casevh at comcast.net> wrote in message
news:1158608090.645965.49970 at m7g2000cwm.googlegroups.com...
> The statement "from __future__ import division" in ModuleB influences
> the byte codes generated when ModuleB is compiled. It doesn't influence
> the byte code generated in ModuleA.
> Start python with the "-Qnew" option.


That is pretty good,
but it affects every module I use,
not just my (selected) modules.

Thanks,
Alan

PS Any news on when true division will be the default?





More information about the Python-list mailing list