Agreed, that is a much better direction to go.
In this particular case you could combine map with filter instead of hiding the filter inside "action"
In this particular case you could combine map with filter instead of hiding the filter inside "action"
def action(thing):
...
return [func(x) for x in thing if func2(x)]