[IPython-dev] from __future__ import division

Fernando Perez fperez.net at gmail.com
Wed Jun 14 12:57:58 CDT 2006


On 6/12/06, Gaël Varoquaux <gael.varoquaux at normalesup.org> wrote:
>         Hi,
>
> I am using ipython to do some numerical work with pylab. At the beginning
> of each script I have "from __future__ import division". When I use these
> scripts with "ipython -pylab" (calling them with a %run -i foobar"),
> pylab doesn't see this import, and thus the script has bugs. One option
> is to load ipython without the -pylab switch and load pylab afterwards,
> but this is to the cost of the nice non blocking pylab interface.
>
> Is there a way to make such an import before pylab gets loaded ? If not
> this may be a useful feature (maybe adding a "-division" switch on the
> command line call).

Mmh, I don't see this problem:

In [1]: 1/2
Out[1]: 0

In [2]: cat div.py
from __future__ import division

print '1/2',1/2

In [3]: run div.py
1/2 0.5

What version are you running?

Cheers,

f




More information about the IPython-dev mailing list