@@ -6062,6 +6062,10 @@ def hist(self, x, bins=None, range=None, normed=False, weights=None,
6062
6062
.. plot:: mpl_examples/statistics/histogram_demo_features.py
6063
6063
6064
6064
"""
6065
+ # Avoid shadowing the builtin.
6066
+ bin_range = range
6067
+ del range
6068
+
6065
6069
def _normalize_input (inp , ename = 'input' ):
6066
6070
"""Normalize 1 or 2d input into list of np.ndarray or
6067
6071
a single 2D np.ndarray.
@@ -6106,13 +6110,6 @@ def _normalize_input(inp, ename='input'):
6106
6110
if bins is None :
6107
6111
bins = rcParams ['hist.bins' ]
6108
6112
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
-
6116
6113
# Validate string inputs here so we don't have to clutter
6117
6114
# subsequent code.
6118
6115
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,
6478
6475
.. plot:: mpl_examples/pylab_examples/hist2d_demo.py
6479
6476
"""
6480
6477
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 ,
6485
6479
normed = normed , weights = weights )
6486
6480
6487
6481
if cmin is not None :
0 commit comments