[Numpy-discussion] Synonym standards

Derek Homeier derek@astro.physik.uni-goettingen...
Fri Jul 27 10:39:58 CDT 2012

On 27.07.2012, at 3:27PM, Benjamin Root wrote:

> > I would prefer not to use:  from xxx import *,
> >
> > because of the name pollution.
> >
> > The name  convention that I copied above facilitates avoiding the pollution.
> >
> > In the same spirit, I've used:
> > import pylab as plb
> But in that same spirit, using np and plt separately is preferred.
> "Namespaces are one honking great idea -- let's do more of those!"
> from http://www.python.org/dev/peps/pep-0020/
> Absolutely correct.  The namespace pollution is exactly why we encourage converts to move over from the pylab mode to separating out the numpy and pyplot namespaces.  There are very subtle issues that arise when doing "from pylab import *" such as overriding the built-in "any" and "all".  The only real advantage of the pylab mode over separating out numpy and pyplot is conciseness, which many matlab users expect at first.

It unfortunately also comes with the convenience of using the "ipython --pylab" mode - 
does anyone know how to turn the "import *" part of, or how to create a similar working 
environment with ipython that does keep namespaces clean?


More information about the NumPy-Discussion mailing list