I am glad lambdas did not get removed. I think another common use of lambdas is partial function application, since Python is missing currying and such.
I encountered the need for this in numeric optimization. I want to have a function with more arguments for readability reasons, but want to fix all of them except my optimization domain.
The pythonic way of doing partial function application is using functools.partial which has a couple of benefits when introspection happens. That said I personally find lambda much more readable than functools.partial.
5 comments
[ 3.3 ms ] story [ 23.4 ms ] threadI encountered the need for this in numeric optimization. I want to have a function with more arguments for readability reasons, but want to fix all of them except my optimization domain.