Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f9bcd6b

Browse filesBrowse files
timhoffmmeeseeksmachine
authored andcommitted
Backport PR #27481: Fixing Pylab documentation in API interface overview
1 parent 11715f9 commit f9bcd6b
Copy full SHA for f9bcd6b

File tree

Expand file treeCollapse file tree

1 file changed

+8
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-3
lines changed

‎galleries/users_explain/figure/api_interfaces.rst

Copy file name to clipboardExpand all lines: galleries/users_explain/figure/api_interfaces.rst
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,11 @@ Appendix: "pylab" interface
285285
---------------------------
286286

287287
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.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.