[IPython-user] reducing function visibility in pylab

belinda thom bthom at cs.hmc.edu
Sun Dec 31 01:42:01 CST 2006


Hi,

Is there a way to run w/the pylab flag but NOT have a pile of  
functions (e.g. plot, axis, ...) show up in the namespace?

What I'd really like is to be able to start in pylab mode (so the  
threading stuff is set up), and then have two modules to show up (in  
such a way that %who can print their names). I'd also like for dir()  
to return very little (not the slew of functions pylab creates).

I get half of what I want by doing:

   ipython
   <snip>
   In [3]: import numpy as N
   In [5]: import pylab as P
   In [6]: who
   N       P

But then I've not started in the pylab mode needed for interactive  
drawing.

I've read up on %who a bit more in the manual and now realize that  
having %who not show modules imported thru config files was  
intentional. However, I can imagine situations (e.g. the classroom)  
where an instructor wants to control how students access things and  
wishes to have them use %who as the "nice interface". In this case,  
I'd want os to show up as O, sys to show up as S, N, and P to be listed.

As always, thanks,

--b



More information about the IPython-user mailing list