2006-09-26 14:33:32 +08:00
|
|
|
"""
|
|
|
|
Providing iterator functions that are not in all version of Python we support.
|
|
|
|
Where possible, we try to use the system-native version and only fall back to
|
|
|
|
these implementations if necessary.
|
|
|
|
"""
|
|
|
|
|
2013-03-20 18:47:56 +08:00
|
|
|
|
2007-09-15 03:55:24 +08:00
|
|
|
def is_iterable(x):
|
|
|
|
"A implementation independent way of checking for iterables"
|
|
|
|
try:
|
|
|
|
iter(x)
|
|
|
|
except TypeError:
|
|
|
|
return False
|
|
|
|
else:
|
|
|
|
return True
|