MCPcopy Create free account
hub / github.com/EntilZha/PyFunctional / is_iterable

Function is_iterable

functional/util.py:70–86  ·  view source on GitHub ↗

Check if val is not a list, but is a collections.Iterable type. This is used to determine when list() should be called on val >>> l = [1, 2] >>> is_iterable(l) False >>> is_iterable(iter(l)) True :param val: value to check :return: True if it is not a list, but

(val)

Source from the content-addressed store, hash-verified

68
69
70def is_iterable(val):
71 """
72 Check if val is not a list, but is a collections.Iterable type. This is used to determine
73 when list() should be called on val
74
75 >>> l = [1, 2]
76 >>> is_iterable(l)
77 False
78 >>> is_iterable(iter(l))
79 True
80
81 :param val: value to check
82 :return: True if it is not a list, but is a collections.Iterable
83 """
84 if isinstance(val, list):
85 return False
86 return isinstance(val, collections.abc.Iterable)
87
88
89def is_tabulatable(val):

Callers 4

__init__Method · 0.90
is_tabulatableFunction · 0.85
test_is_iterableMethod · 0.85

Calls

no outgoing calls

Tested by 2

test_is_iterableMethod · 0.68