MCPcopy Index your code
hub / github.com/python/cpython / always_iterable

Function always_iterable

Lib/test/test_zipfile/_path/_itertools.py:33–43  ·  view source on GitHub ↗
(obj, base_type=(str, bytes))

Source from the content-addressed store, hash-verified

31
32# from more_itertools v8.13.0
33def always_iterable(obj, base_type=(str, bytes)):
34 if obj is None:
35 return iter(())
36
37 if (base_type is not None) and isinstance(obj, base_type):
38 return iter((obj,))
39
40 try:
41 return iter(obj)
42 except TypeError:
43 return iter((obj,))
44
45
46# from more_itertools v9.0.0

Callers 1

wrappedFunction · 0.70

Calls

no outgoing calls

Tested by 1

wrappedFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…