summaryrefslogtreecommitdiff
path: root/numpy/core/oldnumeric.py
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-04-12 22:49:00 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-04-12 22:49:00 +0000
commitec554d0caee4fb34122533eb630e7130e5568db3 (patch)
tree0d5c417ef355aaf07da68aa66c324f8e82d24f20 /numpy/core/oldnumeric.py
parent5534a9987fa9b916a4c035220a3fb488bd315753 (diff)
downloadnumpy-ec554d0caee4fb34122533eb630e7130e5568db3.tar.gz
Fixed where to always return a tuple
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