From: Ludwig Schwardt <ludwig.schwardt@gm...> - 2011-03-23 07:48:06
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 :-)