You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

itercompat.py 386 B

123456789101112131415
  1. """
  2. Providing iterator functions that are not in all version of Python we support.
  3. Where possible, we try to use the system-native version and only fall back to
  4. these implementations if necessary.
  5. """
  6. def is_iterable(x):
  7. "A implementation independent way of checking for iterables"
  8. try:
  9. iter(x)
  10. except TypeError:
  11. return False
  12. else:
  13. return True