diff options
Diffstat (limited to 'numpy/polynomial/polyutils.py')
-rw-r--r-- | numpy/polynomial/polyutils.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/numpy/polynomial/polyutils.py b/numpy/polynomial/polyutils.py index e81275e91..25fd012d6 100644 --- a/numpy/polynomial/polyutils.py +++ b/numpy/polynomial/polyutils.py @@ -35,6 +35,7 @@ __all__ = ['RankWarning', 'PolyError', 'PolyDomainError', 'PolyBase', import warnings, exceptions import numpy as np +import sys # # Warnings and Exceptions @@ -67,11 +68,12 @@ class PolyBase(object) : # # We need the any function for python < 2.5 # -def any(iterable) : - for element in iterable: - if element : - return True - return False +if sys.version_info[:2] < (2,5) : + def any(iterable) : + for element in iterable: + if element : + return True + return False # # Helper functions to convert inputs to 1d arrays @@ -135,7 +137,7 @@ def as_series(alist, trim=True) : arrays = [np.array(a, ndmin=1, copy=0) for a in alist] if min([a.size for a in arrays]) == 0 : raise ValueError("Coefficient array is empty") - if max([a.ndim for a in arrays]) > 1 : + if any([a.ndim != 1 for a in arrays]) : raise ValueError("Coefficient array is not 1-d") if trim : arrays = [trimseq(a) for a in arrays] |