diff options
author | Joseph Fox-Rabinovitz <jfoxrabinovitz@gmail.com> | 2016-02-07 21:50:25 -0500 |
---|---|---|
committer | Joseph Fox-Rabinovitz <joseph.r.fox-rabinovitz@nasa.gov> | 2016-02-10 12:03:48 -0500 |
commit | 4576343702fc31ba27f6462597c63c0ce937cf9c (patch) | |
tree | b3a2a8bc7698942de05b735060d514afac7c1c6e /numpy/lib/function_base.py | |
parent | 920c527ab54b5e9097e0504ddae8d9b2b80a288c (diff) | |
download | numpy-4576343702fc31ba27f6462597c63c0ce937cf9c.tar.gz |
MAINT: Made `iterable` return a boolean
Diffstat (limited to 'numpy/lib/function_base.py')
-rw-r--r-- | numpy/lib/function_base.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 788807086..b8e017eab 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -56,24 +56,24 @@ def iterable(y): Returns ------- - b : {0, 1} - Return 1 if the object has an iterator method or is a sequence, - and 0 otherwise. + b : bool + Return ``True`` if the object has an iterator method or is a + sequence and ``False`` otherwise. Examples -------- >>> np.iterable([1, 2, 3]) - 1 + True >>> np.iterable(2) - 0 + False """ try: iter(y) - except: - return 0 - return 1 + except TypeError: + return False + return True def _hist_optim_numbins_estimator(a, estimator): |