[IPython-User] %run and global variables
Thu Nov 24 01:30:13 CST 2011
On Thu, Nov 24, 2011 at 1:15 AM, Fernando Perez <email@example.com>wrote:
> On Wed, Nov 23, 2011 at 10:26 PM, Tom Bennett
> <firstname.lastname@example.org> wrote:
> > Why is that?
> Because %run by default executes your code in a completely empty
> namespace, so it behaves as if it had been run at a system prompt in a
> fresh python process. After completion of the execution, the
> interactive namespace gets updated with the variables from the script,
> so that you can continue inspecting them and working with them
> In contrast, %run -i runs the script directly in the interactive
> namespace, so that the variables in your namespace prior to execution
> are directly available to the script.
> Hope this clarifies things.
I see. That clarifies it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-User