[IPython-user] namespace question
Fernando Perez
fperez.net at gmail.com
Sun Dec 31 13:44:32 CST 2006
Hi,
On 12/29/06, belinda thom <bthom at cs.hmc.edu> wrote:
> Hi,
>
> I've been using ipython for about 3 weeks now and have some questions
> about what data underlies the who and dir commands.
>
> For instance, when I run ipython -pylab, and I run:
>
> %who
>
> It says:
>
> interactive namespace is empty
>
> yet when I do
>
> dir()
>
> it lists all the matplotlib functions (e.g. Annotation, ArrayType,
> <snip>, zeros) I'd expect (as well is ipython's __IP, _i, ... etc).
>
> I'm fairly new to python, but would have expected "-pylab" to have
> behaved like:
>
> from pylab import *
>
> Note that when I start ipython w/o the -pylab flag and then do:
>
> from pylab import *
>
> then
>
> %who
>
> gives me the whole list (e.g. Annotation, <snip>, zeros).
>
> I'd appreciate some feedback so I can have a mental model of what is
> going on under the hood.
This is due to a design decision. Whether you agree with my reasoning
behind it years ago will lead you to consider it either a bug or a
feature :) The way %who works is basically by filtering the contents
of the user's namespace and removing everything that was put into it
right before the first
In [1]:
prompt showed up. This means that you really only see via %who/%whos
things you've /explicitly/ loaded interactively, not via your startup
configuration options.
It can definitely be modified with a flag to list everything (-a for
'all' would be my choice). If you feel this is important, I'd
appreciate it if you can file a ticket for it at our Trac:
http://projects.scipy.org/ipython/ipython/wiki
(you unfortunately need to register first to file a ticket due to spam
overload). This will ensure we don't miss it and hopefully it can be
put in for 0.7.4, since it's a fairly small amount of effort.
Regards,
f
More information about the IPython-user
mailing list