Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: List of Functions Date: Tue, 29 Mar 2016 14:33:13 +1100 Lines: 25 Message-ID: References: <3c44f0f8-d701-463e-bf2c-f5871c51bddf@googlegroups.com> <87bn5z1mkd.fsf@bsb.me.uk> <56f9c104$0$1604$c3e8da3$5496439d@news.astraweb.com> <87y492xaqh.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de tc39FTLPGkmEN8RQL5Sp9ARIrNVOklwvpBCzlnjZNcJg== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'difference,': 0.07; 'expressions': 0.07; 'stops': 0.07; 'cc:addr:python-list': 0.09; 'identifier': 0.09; 'meaningful': 0.09; 'mess': 0.09; 'statements': 0.09; '(but': 0.15; '"def"': 0.16; '2016': 0.16; 'arrived': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'keywords.': 0.16; 'lambda': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'anonymous': 0.22; 'suppose': 0.22; 'defined': 0.23; 'bit': 0.23; "python's": 0.23; 'written': 0.24; 'header:In-Reply-To:1': 0.24; 'possibility': 0.27; 'message- id:@mail.gmail.com': 0.27; 'function': 0.28; 'this.': 0.28; 'indentation': 0.29; "i'm": 0.30; 'code': 0.30; 'probably': 0.31; 'maybe': 0.33; 'subject:List': 0.33; 'definition': 0.34; 'languages': 0.34; 'tue,': 0.34; 'received:google.com': 0.35; 'could': 0.35; 'done': 0.35; 'designer': 0.35; 'but': 0.36; 'needed': 0.36; 'received:209.85': 0.36; 'keyword': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'received:209.85.213': 0.37; 'received:209': 0.38; 'why': 0.39; 'sure': 0.39; 'some': 0.40; 'more': 0.63; 'mar': 0.65; 'chrisa': 0.84; 'late,': 0.84; 'to:none': 0.91 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; bh=AKYSqe5lT37LZzDZMlNCAKBlXLEzooUIWZJm43F82gg=; b=qBcZ3yVyW/IY1srov6ZgLTTshEbtGUyZP91Wxrxp3iHurcdDWiJsLp5V1S0mM+8GmQ zy6W+prxpYkSzhC1jOKN2u4DikKUkcsWnFk29bYFYIgsqN/S9qoq+1R2QXTfLfmpKrAW 35l3J2cMk/t8VNfzmftCgG1pJ5wvLTCMeWV5xpfYwslWSwoK+PLSOYFg3aDyxzxUDBFX gOB9K/eaOP0W4dju/1aLfx25ctoOkHKE29p+nDndfDAXGGWbrPh+VZibxBGFP4f8OUaY FMBOCG2vk5UMLcASiTc+B7+inYcj1tSrOMw0h9LZIEqyCDT7CyDgKhXSI+pQrxJb4gIR 7ENg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=AKYSqe5lT37LZzDZMlNCAKBlXLEzooUIWZJm43F82gg=; b=QMVIiypCIrp8R/5anINA50aBYuF6IdavV+vJVu1WfU4V9J03lQZLHs7UjS/g2cCN3I /XFLQvJeXitWFmsM6HFIb1iLVVS3Np3tKbx87mKBWfzTQAzq/KVMda345ppUvGtsecoc zy7bUV7tahusSrB7MO7rE0lOmNg5Gsy2KoD2Vuk+YSvJk/0wzSf5QhyjawfcWu1TTjkf M0atnMaOYqUCLdyzC6E2W+Io1/1EabPnwB4uZzZ9NdYTvBSNNyJLTI8Riu+D5X12dcY2 uBPMHmERr0LYpwoBmp2dixFAmnw4e1KN6EBusSG2o3pMpcrI9kF/ad4lmKW2VRv4Nqop xjlQ== X-Gm-Message-State: AD7BkJID+kKlDbLQBq9rzqLkBg8JS6Ja6wyogViel5Fc0b6BM2mV57mHb3j8pOLEahoxawdtqDKWhXuJ8IvvSw== X-Received: by 10.50.138.233 with SMTP id qt9mr424571igb.13.1459222393498; Mon, 28 Mar 2016 20:33:13 -0700 (PDT) In-Reply-To: <87y492xaqh.fsf@bsb.me.uk> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:105943 On Tue, Mar 29, 2016 at 1:45 PM, Ben Bacarisse wrote: > If functions were defined > > fun f(x): return x * x > > then an anonymous function could be written as a function definition but > the name > > fun (x): return x * x > > I suppose you could do that even with "def" but it's a bit less > mnemonic. > > There's probably a good reason why this was not done -- maybe it stops > the grammar being LL(1)? And if lambda's arrived late, and a new > keyword is needed to flag a function expression, then lambda is > appealing to the designer since it's less likely to be in use as an > identifier in existing code than many more meaningful keywords. Some languages are exactly like this. I'm not sure what the reason is for Python's difference, but one possibility is the mess that comes from having statements inside expressions when indentation is significant to statements (but free-form in expressions). ChrisA