The title might be a bit misleading but I couldn't find a good way to express myself. Essentially if I had code like this:
def test_function(inputs):
parameters = non_trivial_manipulation(inputs)
return lambda x: some_function(parameters, x)
test = test_function(inputs)
My question is, does it go through all the manipulations in test_function
every time I use test
, or does Python somehow "cache" this so that the above code is actually efficient? If the latter, how does it do that?
Thanks!