Skip to content

Commit 5a3b8b1

Browse files
committed
Revert "Faster isiterable when x isn't iterable."
This reverts commit f0831e7.
1 parent 1aa72df commit 5a3b8b1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

toolz/itertoolz.py

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

288292

289293
def isdistinct(seq):

0 commit comments

Comments
 (0)