Skip to content

Commit 1aa72df

Browse files
authored
Merge pull request #545 from groutr/isiterable
Faster check for isiterable
2 parents 19edc08 + f0831e7 commit 1aa72df

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

toolz/itertoolz.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,11 +283,7 @@ def isiterable(x):
283283
>>> isiterable(5)
284284
False
285285
"""
286-
try:
287-
iter(x)
288-
return True
289-
except TypeError:
290-
return False
286+
return hasattr(x, "__iter__")
291287

292288

293289
def isdistinct(seq):

0 commit comments

Comments
 (0)