Welcome, guest | Sign In | My Account | Store | Cart
def isallinstance(iterable, typeOrTuple):
    return all(isinstance(i, typeOrTuple) for i in iterable)




## Previous Version:
##
## def isallinstance(iterable, typeOrTuple):
##     vals = [isinstance(i, typeOrTuple) for i in iterable]
##     return len(vals) == sum(vals)

Diff to Previous Revision

--- revision 1 2012-07-26 16:04:40
+++ revision 2 2012-07-26 18:09:30
@@ -1,3 +1,11 @@
 def isallinstance(iterable, typeOrTuple):
-    vals = [isinstance(i, typeOrTuple) for i in iterable]
-    return len(vals) == sum(vals)
+    return all(isinstance(i, typeOrTuple) for i in iterable)
+
+
+
+
+## Previous Version:
+##
+## def isallinstance(iterable, typeOrTuple):
+##     vals = [isinstance(i, typeOrTuple) for i in iterable]
+##     return len(vals) == sum(vals)

History