Skip to content

Instantly share code, notes, and snippets.

@pyrtsa
Created October 13, 2011 19:30
Show Gist options
  • Save pyrtsa/1285258 to your computer and use it in GitHub Desktop.
Save pyrtsa/1285258 to your computer and use it in GitHub Desktop.
iterable(x)
def iterable(x):
"""Check whether x supports iteration"""
# originally implemented in NumPy, http://bit.ly/mSbVjo
try: iter(x)
except: return False
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment