summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index d67b97b1d..43bd3af8b 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -33,6 +33,9 @@ from ._compiled_base import add_newdoc_ufunc
import numpy as np
import collections
+# Force range to be a generator, for np.delete's usage.
+if sys.version_info[0] < 3:
+ range = xrange
def iterable(y):
"""
@@ -3467,7 +3470,7 @@ def delete(arr, obj, axis=None):
if isinstance(obj, slice):
start, stop, step = obj.indices(N)
- xr = xrange(start, stop, step)
+ xr = range(start, stop, step)
numtodel = len(xr)
if numtodel <= 0: