diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2008-08-28 22:53:06 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2008-08-28 22:53:06 +0000 |
commit | e4656b563cd33e50983635c5dcc79a7d4e5aedc5 (patch) | |
tree | b0f34d384aef6c46ecd383dcec41ca6f77a08b55 /numpy/core/numeric.py | |
parent | c84e0c0279747c6023207876838106aef2dbbc6d (diff) | |
download | numpy-e4656b563cd33e50983635c5dcc79a7d4e5aedc5.tar.gz |
Change convolve to raise ValueError on runtime error instead of relying on
assert. The latter fails when run with python -OO.
Diffstat (limited to 'numpy/core/numeric.py')
-rw-r--r-- | numpy/core/numeric.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 449754f87..96fc1ada0 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -571,13 +571,15 @@ def convolve(a,v,mode='full'): array([ 2.5]) """ - a,v = array(a,ndmin=1),array(v,ndmin=1) + a,v = array(a, ndmin=1),array(v, ndmin=1) if (len(v) > len(a)): a, v = v, a - assert len(a) > 0, 'a cannot be empty' - assert len(v) > 0, 'v cannot be empty' + if len(a) == 0 : + raise ValueError('a cannot be empty') + if len(v) == 0 : + raise ValueError('v cannot be empty') mode = _mode_from_name(mode) - return multiarray.correlate(a,asarray(v)[::-1],mode) + return multiarray.correlate(a, v[::-1], mode) inner = multiarray.inner dot = multiarray.dot |