[IPython-dev] Where should __future__ statements affect the interactive environment.

Thomas Kluyver takowl at gmail.com
Mon Apr 23 06:25:31 EDT 2012

On 23 April 2012 05:20, Fernando Perez <fperez.net at gmail.com> wrote:
> - run: yes, if a __future__ is imported in a file that was %run, then
> it should become active interactively.  The reason is to keep the
> semantics of operating with things defined in that script consistent.
> Say a script had `z=x/y` in it, you want to be able to later type at
> the command-line `x/y` and get the same division semantics that were
> set inside the script.

On the other hand, %run (without -i) works a bit like doing `from foo
import *`, in which case you don't get semantic changes from
__future__ statements in foo. I'm inclined to agree with you that I'd
expect __future__ statements in %run to affect the interactive
environment, but I don't think it's entirely clear cut.


More information about the IPython-dev mailing list