Python: Functional Composition vs. **kwargs -
i confused compose function in python. i've read there 2 possible uses:
compose(f,g)(x) ~> f(g(x)) and
compose(f,g, unpack=true)(x) ~> f(*g(x)) the latter beingness used in
def f(a,b): homecoming + b def g(x): homecoming [x,x] so above code result in
compose(f,g, unpack=true)(x) ~> f(*g(x)) ~> f(x,x). now question: how handle keywords in context?
more compose functions seems work functions signature
def f(*args): ... def g(*args): ... take illustration function call
f(4,5, = some_info). is possible write composite via compose? if so, g should have unpacked output in form of
***g(x) = 4,5,extra=some_info(x). python functional-programming composition higher-order-functions
No comments:
Post a Comment