In numerix.py, the following loop:
if hasattr(sys, 'argv'): #Once again, Apache mod_python has no argv
for a in sys.argv:
if a in ["--Numeric", "--numeric", "--NUMERIC",
"--Numarray", "--numarray", "--NUMARRAY"]:
which = a[2:], "command line"
break
leaves behind a variable called 'a', which gets pulled in when the user does a
'from matplotlib.matlab import *'. This seems like a minor annoyance, except
that it breaks ipython's 'whos' command in pylab mode, since whos tries to
distinguish between variables interactively defined by the user and those
loaded during internal initialization. Since the name 'a' appears in internal
initialization, whos hides it later:
[matplotlib]> which pylab
pylab: aliased to ipython -pylab --nobanner
[matplotlib]> pylab
In [1]: a
Out[1]: '--nobanner'
In [2]: a='Hello!'
In [3]: a
Out[3]: 'Hello!'
In [4]: whos
Interactive namespace is empty.
A simple 'del a' after the loop indicated above fixes this issue. In general,
for modules which are meant for 'from foo import *', it's a good idea to make
sure no internal locals are left around.
Best,
f
|