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

Aaron Meurer asmeurer at gmail.com
Mon Apr 23 14:41:39 EDT 2012

I thought %run was more like executing the script from the command
line.  In other words, if you have

if __name__ == '__main__':

then blah will be run for %run (but it wouldn't in an import).

There are probably other invariants that hold in one situation but not
the other.

Aaron Meurer

On Mon, Apr 23, 2012 at 4:44 AM, Fernando Perez <fperez.net at gmail.com> wrote:
> On Mon, Apr 23, 2012 at 3:25 AM, Thomas Kluyver <takowl at gmail.com> wrote:
>> 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.
> I was thinking more about what the more natural workflow would be,
> since we pitch %run more closely related to "run a script as if you
> had typed all that interactively" than "a shorthand for 'import *'".
> But you are right, one could think of it either way...
> f
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

More information about the IPython-dev mailing list