[Numpy-discussion] Synonym standards

Tony Yu tsyu80@gmail....
Fri Jul 27 10:58:26 CDT 2012


On Fri, Jul 27, 2012 at 11:39 AM, Derek Homeier <
derek@astro.physik.uni-goettingen.de> wrote:

> 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?
>
> Cheers,
>                                                 Derek
>


 There's a config flag that you can add to your ipython profile:

c.TerminalIPythonApp.pylab_import_all = False

For example, my profile is in ~/.ipython/profile_default/ipython_config.py

Cheers,
-Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20120727/297e00b4/attachment.html 


More information about the NumPy-Discussion mailing list