function composition of single argument functions is a simple 1 liner.
how would I (if it's possible) write the following composition in 1 line?
def fn(x: int) -> str:
def inner(a, b):
return strjoin(a, g(b))
return inner(*f(x))
You can convert any one-line function whose only statement is a
returnto alambdatrivially. So you can write it this way.Now, as for why you would do that, I'm not sure, unless you're getting paid by the line of code and abhor the idea of making money.
Most people would write the more approachable