How do you apply a list of lambda functions to a single element using an iterator?
I want to apply a list of lambda functions to a single element using an iterable that has to be created with yield.
The list of lambda functions would have something like:
[<function <lambda> at 0x1d310c8>, <function <lambda> at 0x1d355f0>]
And I want to apply every function, from left to right , to a single element using yield to construct an iterable to iterate the list
def apply_all(functions, item): for f in functions: yield f(item)
functions = [type, id, hex] for result in apply_all(functions, 55): print result
<type 'int'> 20326112 0x37