Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1a.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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'beginner': 0.05; 'subject:Question': 0.07; 'etc).': 0.09; 'methods,': 0.09; 'objects,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'creates': 0.14; '"def"': 0.16; '"for"': 0.16; '"lambda"': 0.16; 'callables': 0.16; 'called,': 0.16; 'constructor.': 0.16; 'expression,': 0.16; 'finney': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'function;': 0.16; 'statement.': 0.16; 'sugar': 0.16; 'syntactic': 0.16; 'wrote:': 0.18; '(not': 0.18; 'cc:addr:python.org': 0.22; 'creating': 0.23; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'function': 0.29; "doesn't": 0.30; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'usually': 0.31; 'could': 0.34; 'created': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'functions.': 0.36; 'like,': 0.36; 'programming,': 0.36; 'method': 0.36; 'ben': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'even': 0.60; 'new': 0.61; 'skip:\xe2 10': 0.65; 'between': 0.67; 'statement,': 0.68; 'fact,': 0.69; '8bit%:43': 0.74; 'special': 0.74; 'distinguish': 0.84; 'etc,': 0.84; '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=msK+7hdJo+At24O3HWZguAcCNK1Oz75xsXGGDxuhtzA=; b=pG01IIh2OcQCb6F3SQ6WXh2NlkEVrTNMLanQRIettWYPsEzah3k92aOmnqjpLP3nlE Vq5VPL9zYLZsxxA++YLHJodTCpkurQ9ywhNBMBala1rAI5eKgfHrZpHZDro3DK6m/TJp U+C6iJnWgfcPrWq/0pHCIqZMuFkRQEDC3mES5FTpSivBe7l67QIMdyDvnqOmQ3v54EET Mz6CTbDPXgTS8gUCJ13SGEQ4fgNLaJDIEGGP2Ovz83hYFmDCjIeaCwbCaP5eBllNTrtR h1V6TlWJTNQdxtfsbN450M1A7g3c3HQXmhALviPRAW2n8zUEzOAY+x0U8JIwJLmtD7Pn 5NWw== MIME-Version: 1.0 X-Received: by 10.152.21.66 with SMTP id t2mr18878639lae.27.1418089985799; Mon, 08 Dec 2014 17:53:05 -0800 (PST) In-Reply-To: <548653EC.5080107@gmx.de> References: <548653EC.5080107@gmx.de> Date: Tue, 9 Dec 2014 12:53:05 +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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1418089988 news.xs4all.nl 2928 [2001:888:2000:d::a6]:35219 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:82170 On Tue, Dec 9, 2014 at 12:44 PM, Christoph Becker wrote= : > Ben Finney wrote: > >> It's best to remember that =E2=80=98lambda=E2=80=99 is syntactic sugar f= or creating a >> function; the things it creates are not special in any way, they are >> normal functions, not =E2=80=9Clambdas=E2=80=9D. > > Could you please elaborate why =E2=80=98lambda=E2=80=99 does not create = =E2=80=9Clambdas=E2=80=9D. I'm > a Python beginner (not new to programming, though), and rather confused > about your statement. For the same reason that "def" doesn't create "defs", and "for" doesn't create fors (uhh... the Force?). Both "lambda" and "def" create functions. Functions are things that can be called, and they're created by the "def" statement, the "lambda" expression, and very VERY occasionally, by directly calling the function constructor. You could distinguish between "lambda functions" and "def functions" if you like, but the distinction is almost never significant. In fact, usually you don't even need to distinguish between functions and other callables (types, objects with __call__ methods, bound method objects, etc, etc, etc). ChrisA