File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Filter options
galleries/users_explain/figure Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Original file line number Diff line number Diff line change @@ -285,6 +285,11 @@ Appendix: "pylab" interface
285
285
---------------------------
286
286
287
287
There is one further interface that is highly discouraged, and that is to
288
- basically do ``from matplotlib.pyplot import * ``. This allows users to simply
289
- call ``plot(x, y) ``. While convenient, this can lead to obvious problems if the
290
- user unwittingly names a variable the same name as a pyplot method.
288
+ basically do ``from matplotlib.pylab import * ``. This imports all the
289
+ functions from ``matplotlib.pyplot ``, ``numpy ``, ``numpy.fft ``, ``numpy.linalg ``, and
290
+ ``numpy.random ``, and some additional functions into the global namespace.
291
+
292
+ Such a pattern is considered bad practice in modern python, as it clutters
293
+ the global namespace. Even more severely, in the case of ``pylab ``, this will
294
+ overwrite some builtin functions (e.g. the builtin ``sum `` will be replaced by
295
+ ``numpy.sum ``), which can lead to unexpected behavior.
You can’t perform that action at this time.
0 commit comments