summaryrefslogtreecommitdiff
path: root/numpy/lib/function_base.py
diff options
context:
space:
mode:
authorStefan van der Walt <stefan@sun.ac.za>2006-09-18 23:27:24 +0000
committerStefan van der Walt <stefan@sun.ac.za>2006-09-18 23:27:24 +0000
commit371f8c6a1df8b2d244afd50d03e492d79a1372fe (patch)
tree2d6d3cd8e59ea5da96e5bb710cf890a11696b293 /numpy/lib/function_base.py
parent29cb5ffae98ad43a3e7ebada8dc77ce0a4045529 (diff)
downloadnumpy-371f8c6a1df8b2d244afd50d03e492d79a1372fe.tar.gz
Add ediff1d support for empty arrays.
Fix ediff1d for to_begin or to_end = 0. Allow insert to operate on empty arrays.
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r--numpy/lib/function_base.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py
index 0ede094f7..5bcd3a443 100644
--- a/numpy/lib/function_base.py
+++ b/numpy/lib/function_base.py
@@ -1286,7 +1286,7 @@ def insert(arr, obj, values, axis=None):
newshape = list(arr.shape)
if isinstance(obj, (int, long, integer)):
if (obj < 0): obj += N
- if (obj < 0 or obj >=N):
+ if (obj < 0 or obj > N or (obj == N and N != 0)):
raise ValueError, "index (%d) out of range (0<=index<=%d) "\
"in dimension %d" % (obj, N, axis)
newshape[axis] += 1;