Commit 76be0551 authored by Michael Büsch's avatar Michael Büsch

util: Add helper to check if an object is iterable

Signed-off-by: Michael Büsch's avatarMichael Buesch <m@bues.ch>
parent 0a695297
......@@ -226,3 +226,13 @@ def envClearLang(env, lang = "C"):
"LC_IDENTIFICATION",}:
env.pop(i, None)
return env
def isiterable(obj):
"""Check if an object is iterable.
"""
try:
iter(obj)
return True
except TypeError:
pass
return False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment