[IPython-dev] dictionaries and %run oddity

Kevin Buchs kevin.buchs at gmail.com
Wed Nov 30 08:56:15 EST 2011


Thanks for your reply. What you observed about list, integer are what I see
and I must retract my unusuality. I must have transposed something in my
memory from the night before.

There is something that is not making sense to me from your explanation.
Here is my paraphrase of what I think you are saying. When I %run a
command, it is given its own namespace, say N1. Any variables defined in
that namespace are copied to the original namespace of my iPython session,
say N0. The function definition is not copied, however. When I then invoke
(not %run) the function from N0, it runs in N1. Then any variables created
in N1 are NOT copies to N0. So, if I would %run the function definition and
invocation in one command, then any variables defined are copied back.

What does not make sense to me is if I declare a variable global in a
function declared in a certain namespace, shouldn't that mean it is
available in the global namespace?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20111130/896fa2df/attachment.html>

More information about the IPython-dev mailing list