Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'parameters': 0.04; 'syntax': 0.04; 'subject:Question': 0.07; 'function,': 0.09; 'parameter': 0.09; 'cc:addr:python-list': 0.11; 'creates': 0.14; 'called,': 0.16; 'expects': 0.16; 'finney': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'lambda': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'dec': 0.30; 'forgot': 0.30; 'message- id:@mail.gmail.com': 0.30; 'received:google.com': 0.35; 'ben': 0.38; 'skip:x 10': 0.40; 'new': 0.61; 'skip:\xe2 10': 0.65; 'default': 0.69; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=za1JKVI26Ht7slHFfNkeE8S+2thIb4wZxDWQDxMiJto=; b=IlfKwHqkehlIF3gcaFRxMjvKCzofY9hhGDOzZtlv3NdniWyPNGT/U6sGwN/UX9Jdxq Tj2caS8CMnikjjzgJs+UwRrwrJIBxU3Bi/6Z9CN6aT0C69zFnlXUpGrwEWTUg9XIY7WS P98C7CC/jO5IPF1pzn1Aast/k9Qcg3PppewFOL+4XzELsAsHX5jETUyCvatQufEmATSo mNAmNyySafh93xBQ7Bnf2FoDbnPoT+LKYn1GOVu6Tp97eYLHoR84dFAesVw5s976THRM iscOmrounYRIAPY8umaB6KdJYDxx6rOLcuoBBM5xNU0jWuAnoQ8RbTRLdw1oStNML+al JCdQ== MIME-Version: 1.0 X-Received: by 10.50.62.104 with SMTP id x8mr17689918igr.2.1418083248651; Mon, 08 Dec 2014 16:00:48 -0800 (PST) In-Reply-To: <85oarditil.fsf@benfinney.id.au> References: <85oarditil.fsf@benfinney.id.au> Date: Tue, 9 Dec 2014 11:00:48 +1100 Subject: Re: Question on lambdas From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418083251 news.xs4all.nl 2830 [2001:888:2000:d::a6]:35622 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82161 On Tue, Dec 9, 2014 at 10:58 AM, Ben Finney wr= ote: >> lambda x=3Dsome_value: some_expr > > This creates a new function which expects one parameter named =E2=80=98x= =E2=80=99, which > parameter has a default value of =E2=80=98some_value=E2=80=99. The functi= on, when > called, will return the value of =E2=80=98some_expr=E2=80=99. *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=3De:" syntax is doing. ChrisA