In my code I have yet another version:
"""Checks if object is iterable (but not a string)."""
return hasattr(x, '__iter__')
I specifically wanted to test for lists, tuples and numpy arrays, but
not strings. Depending on the semantics of underscored methods could
be considered flaky coding, though