From ec554d0caee4fb34122533eb630e7130e5568db3 Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Wed, 12 Apr 2006 22:49:00 +0000 Subject: Fixed where to always return a tuple --- numpy/core/oldnumeric.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'numpy/core/oldnumeric.py') 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 -- cgit v1.2.1