[Numpy-discussion] Numeric3

Fernando Perez Fernando.Perez at colorado.edu
Tue Feb 8 16:50:11 CST 2005


Ralf Juengling wrote:

> This is on of the hallmarks of Python that facilitate rapid 
> development: When you want to get familiar with an unfamiliar 
> library module, start up python in a shell, do the 
> "from XXX import *" thing, and start playing.

If I may suggest, it tends to be a lot more efficient to explore an unknown 
library by doing

import XXX_LONGNAME_XXX as X

and start tab-completing away on X.<TAB>, or X.get<TAB> for getters, etc. 
This way, you know you can restrict your completions to only the thing you are 
trying to study, instead of all of its names colliding with builtins and globals.

So if anything, interactive _exploration_ of a library is one place not to use 
'from XXX import *'.

Interactive _use_ is an altogether different story.  I constantly use ipython 
in -pylab mode, which pulls all of matplotlib.pylab, and up until a week ago 
did the same with the supplied numeric profile (which used Numeric and 
Gnuplot).   But this is for using names I already know well.  And I still make 
a point, even in these conditions, of having pylab/Numeric available as 
top-level names, so I can do selective tab-completion on them when I need to 
fish around for something I don't know or whose specific name I can't remember.

Just a small comment.

Best,

f




More information about the Numpy-discussion mailing list