changeset 21:0149be5a984c

[iterable] add function to tell True/False if argument is an iterable
author Jeff Hammel <k0scist@gmail.com>
date Mon, 04 Sep 2017 08:37:06 -0700
parents d6d2ecb33c95
children 3713c6733990
files tvii/iterable.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tvii/iterable.py	Mon Sep 04 08:37:06 2017 -0700
@@ -0,0 +1,6 @@
+def isiterable(x):
+    try:
+        iter(x)
+        return True
+    except TypeError:
+        return False