Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #82161 > unrolled thread

Re: Question on lambdas

Started byChris Angelico <rosuav@gmail.com>
First post2014-12-09 11:00 +1100
Last post2014-12-09 11:00 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Question on lambdas Chris Angelico <rosuav@gmail.com> - 2014-12-09 11:00 +1100

#82161 — Re: Question on lambdas

FromChris Angelico <rosuav@gmail.com>
Date2014-12-09 11:00 +1100
SubjectRe: Question on lambdas
Message-ID<mailman.16747.1418083251.18130.python-list@python.org>
On Tue, Dec 9, 2014 at 10:58 AM, Ben Finney <ben+python@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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web