From 371f8c6a1df8b2d244afd50d03e492d79a1372fe Mon Sep 17 00:00:00 2001 From: Stefan van der Walt Date: Mon, 18 Sep 2006 23:27:24 +0000 Subject: Add ediff1d support for empty arrays. Fix ediff1d for to_begin or to_end = 0. Allow insert to operate on empty arrays. --- numpy/lib/function_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'numpy/lib/function_base.py') 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; -- cgit v1.2.1