[SciPy-user] really basic where() function question

Fernando Perez fperez.net@gmail....
Wed Sep 12 19:59:34 CDT 2007

On 8/28/07, Kurt Smith <kwmsmith@gmail.com> wrote:

> Moral: be careful about importing * from pylab (or running $ ipython
> -pylab)!  Its functions aren't the same as numpy/scipy.

Or more accurately,  set

pylab_import_all 0

in your ~/.ipython/ipythonrc file, to prevent the implicit

from pylab import *

that ipython -pylab normally does.

It's worth also noting that pylab is being cleaned up from all this
historical cruft, and will gradually become a purely numpy-compatible
tool, so these nasty gotchas will mostly go away.  These problems come
from the fact was written back when Numeric and numarray both existed,
with non-overlapping functionality.  Pylab tried to expose some
unified interface on top, which by necessity was different from either
(it even added its own stuff).

Over time, these problems will gradually go down, but you may prefer
(I think it's safer) to set the above flag, and then use an ipython
profile that does

import pylab as P  # or whatever shorthand you like, if any
import numpy as N

from pylab import plot, ... (put here the things you really use
interactively a lot)
from numpy import *

With this, you only expose at the top level the real numpy and the
plotting-related parts of pylab you actually need, as well as having
two quick handles (N,P) to access numpy/pylab.



More information about the SciPy-user mailing list