summaryrefslogtreecommitdiff
path: root/numpy/core/oldnumeric.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/oldnumeric.py')
-rw-r--r--numpy/core/oldnumeric.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/numpy/core/oldnumeric.py b/numpy/core/oldnumeric.py
index b8685d69e..4674cfdd9 100644
--- a/numpy/core/oldnumeric.py
+++ b/numpy/core/oldnumeric.py
@@ -366,8 +366,15 @@ def nonzero(a):
try:
nonzero = a.nonzero
except AttributeError:
- return _wrapit(a, 'nonzero')
- return nonzero()
+ res = _wrapit(a, 'nonzero')
+ else:
+ res = nonzero()
+
+ if len(res) == 1:
+ return res[0]
+ else:
+ raise ValueError, "Input argument must be 1d"
+
def shape(a):
"""shape(a) returns the shape of a (as a function call which