Numpy array index handling

sturlamolden sturlamolden at yahoo.no
Fri Jul 13 17:37:32 EDT 2007


On 13 Jul, 22:52, phish... at gmail.com wrote:

> It seems a bit risky to use 'from scipy import *'. Maybe it's better
> to use 'import scipy' and then scipy.arange, to be sure what is
> actually being used? Would there be any disadvanages with that
> approach, other than more use of the keyboard?

Generally the idiom

from something import *

is discouraged as it clutters the namespace (it can e.g. shadow
globals).

I prefer something like:

import numpy as np

Also I suggest you don't use SciPy and Matplotlib (pylab) unless you
mean it. Import from numpy instead. Import pylab if you need graphs
and scipy if you need something special that is not in numpy.

Get the latest installer (or sources) from:

Python 2.5.1: www.python.org
NumPy 1.0.3: www.scipy.org
SciPy 0.5.2: www.scipy.org
Matplotlib 0.90.1: matplotlib.sourceforge.net
PIL 1.1.6: www.pythonware.com/products/pil/
wxPython 2.8.4.0: www.wxpython.org
gcc and gfortran (for scipy.wave): http://gcc.gnu.org/wiki/GFortranBinaries

At least that is what makes me as a scientist happy with Python :)

Enthought and similar distros are in my experience "unclean". They
don't always work and they are difficult to update. I rather download
the binary installers (for Windows) and install the packages I need.

I also suggest you buy a copy of "Guide to NumPy" by Travis Oliphant.
http://www.tramy.us/guidetoscipy.html

S.M.




































More information about the Python-list mailing list