MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / combine

Function combine

example_code/item_124_example_08.py:28–35  ·  view source on GitHub ↗
(func: Func[Value], values: list[Value])

Source from the content-addressed store, hash-verified

26Func = Callable[[Value, Value], Value]
27
28def combine(func: Func[Value], values: list[Value]) -> Value:
29 assert len(values) > 0
30
31 result = values[0]
32 for next_value in values[1:]:
33 result = func(result, next_value)
34
35 return result
36
37Real = TypeVar("Real", int, float)
38

Callers 1

Calls 1

funcFunction · 0.85

Tested by

no test coverage detected