My full question sound this way: How to compose (combine) several function calls with arguments without using partial.
Right now current code below works fine, but I need to call partial every time any additional argument is provided:
from functools import partial
def pipe(data, *funcs):
for func in funcs:
data = func(data)
return data
def mult(data, amount=5, bias=2):
return data*amount + bias
def divide(data, amount, bias=1):
return data/amount + bias
result = pipe(5,
mult,
partial(divide, amount=10)
)
print(result)
# 3.7
But I would like to partial to be called inside of pipe function. So calling should start looking this way:
result = pipe(5,
mult,
divide(amount=10)
)