Question on lambdas
Chris Angelico
rosuav at gmail.com
Mon Dec 8 19:00:48 EST 2014
On Tue, Dec 9, 2014 at 10:58 AM, Ben Finney <ben+python at benfinney.id.au> wrote:
>> lambda x=some_value: some_expr
>
> This creates a new function which expects one parameter named ‘x’, which
> parameter has a default value of ‘some_value’. The function, when
> called, will return the value of ‘some_expr’.
*facepalm* For some reason I forgot about default parameters _inside_
the lambda function, and thought only of named parameters _outside_
it. Ben's right, that's what your "lambda e=e:" syntax is doing.
ChrisA
More information about the Python-list
mailing list