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 64b9ece

Browse filesBrowse files
NelleVQuLogic
authored andcommitted
Merge pull request matplotlib#8331 from anntzer/dont-use-__builtins__
Don't index into __builtins__ (not supported by PyPy).
1 parent a538693 commit 64b9ece
Copy full SHA for 64b9ece

File tree

Expand file treeCollapse file tree

1 file changed

+5
-11
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-11
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+5-11Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6062,6 +6062,10 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None,
60626062
.. plot:: mpl_examples/statistics/histogram_demo_features.py
60636063
60646064
"""
6065+
# Avoid shadowing the builtin.
6066+
bin_range = range
6067+
del range
6068+
60656069
def _normalize_input(inp, ename='input'):
60666070
"""Normalize 1 or 2d input into list of np.ndarray or
60676071
a single 2D np.ndarray.
@@ -6106,13 +6110,6 @@ def _normalize_input(inp, ename='input'):
61066110
if bins is None:
61076111
bins = rcParams['hist.bins']
61086112

6109-
# xrange becomes range after 2to3
6110-
bin_range = range
6111-
range = __builtins__["range"]
6112-
6113-
# NOTE: the range keyword overwrites the built-in func range !!!
6114-
# needs to be fixed in numpy !!!
6115-
61166113
# Validate string inputs here so we don't have to clutter
61176114
# subsequent code.
61186115
if histtype not in ['bar', 'barstacked', 'step', 'stepfilled']:
@@ -6478,10 +6475,7 @@ def hist2d(self, x, y, bins=10, range=None, normed=False, weights=None,
64786475
.. plot:: mpl_examples/pylab_examples/hist2d_demo.py
64796476
"""
64806477

6481-
# xrange becomes range after 2to3
6482-
bin_range = range
6483-
range = __builtins__["range"]
6484-
h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=bin_range,
6478+
h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=range,
64856479
normed=normed, weights=weights)
64866480

64876481
if cmin is not None:

0 commit comments

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