##// END OF EJS Templates
Fix name pollution of interactive namespace in pylab mode....
Fernando Perez -
Show More
@@ -381,7 +381,7 b' class IPCompleter(Completer):'
381 381 """Extension of the completer class with IPython-specific features"""
382 382
383 383 def __init__(self, shell, namespace=None, global_namespace=None,
384 omit__names=0, alias_table=None, use_readline=True):
384 omit__names=True, alias_table=None, use_readline=True):
385 385 """IPCompleter() -> completer
386 386
387 387 Return a completer object suitable for use by the readline library
@@ -96,15 +96,17 b' def import_pylab(user_ns, backend, import_all=True, shell=None):'
96 96
97 97 # Import numpy as np/pyplot as plt are conventions we're trying to
98 98 # somewhat standardize on. Making them available to users by default
99 # will greatly help this.
100 exec ("import numpy\n"
99 # will greatly help this.
100 s = ("import numpy\n"
101 101 "import matplotlib\n"
102 102 "from matplotlib import pylab, mlab, pyplot\n"
103 103 "np = numpy\n"
104 104 "plt = pyplot\n"
105 ) in user_ns
105 )
106 exec s in user_ns
106 107
107 108 if shell is not None:
109 exec s in shell.user_ns_hidden
108 110 # If using our svg payload backend, register the post-execution
109 111 # function that will pick up the results for display. This can only be
110 112 # done with access to the real shell object.
@@ -117,6 +119,7 b' def import_pylab(user_ns, backend, import_all=True, shell=None):'
117 119 figsize(6.0, 4.0)
118 120 # Add 'figsize' to pyplot and to the user's namespace
119 121 user_ns['figsize'] = pyplot.figsize = figsize
122 shell.user_ns_hidden['figsize'] = figsize
120 123 else:
121 124 from IPython.zmq.pylab.backend_inline import pastefig
122 125 from matplotlib import pyplot
@@ -124,8 +127,11 b' def import_pylab(user_ns, backend, import_all=True, shell=None):'
124 127 user_ns['pastefig'] = pyplot.pastefig = pastefig
125 128
126 129 if import_all:
127 exec("from matplotlib.pylab import *\n"
128 "from numpy import *\n") in user_ns
130 s = ("from matplotlib.pylab import *\n"
131 "from numpy import *\n")
132 exec s in user_ns
133 if shell is not None:
134 exec s in shell.user_ns_hidden
129 135
130 136
131 137 def pylab_activate(user_ns, gui=None, import_all=True):
General Comments 0
You need to be logged in to leave comments. Login now