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

Function combine

example_code/item_124.py:97–104  ·  view source on GitHub ↗
(func, values)

Source from the content-addressed store, hash-verified

95print("Example 7")
96try:
97 def combine(func, values):
98 assert len(values) > 0
99
100 result = values[0]
101 for next_value in values[1:]:
102 result = func(result, next_value)
103
104 return result
105
106 def add(x, y):
107 return x + y

Callers 1

item_124.pyFile · 0.70

Calls 1

funcFunction · 0.85

Tested by

no test coverage detected