Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82161
| References | <m65d2m$3pe$1@ger.gmane.org> <85oarditil.fsf@benfinney.id.au> |
|---|---|
| Date | 2014-12-09 11:00 +1100 |
| Subject | Re: Question on lambdas |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16747.1418083251.18130.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Question on lambdas Chris Angelico <rosuav@gmail.com> - 2014-12-09 11:00 +1100
csiph-web