Function for timing executions (inspired by MATLAB tic toc)
I have a minor stylistic point, but you don't need (and shouldn't use) brackets around return values. Neither the lambda itself nor the lambda's return value.

return lambda: time() - t


It is minor but it actually confused me and made me think there was more of an expression there because of how rarely brackets are used like this.