Lets say we have functions in python:
def _abs(iterable): #cause its normally for one element only
return [abs(i) for i in iterable]
def A(list, foo):
return foo(list)
list = [2,3,-5]
print( A(list,foo=sum) )
>> 0
while I may pass foo=sum
to A, I am looking for an elegant way to pass something like foo=sum(_abs)
to perform sum(_abs(list))
.
The only way I see it now is to send a list of functions [sum, _abs]
and apply them in order. Is there a better way?