Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'subject:Python': 0.06; 'mentions': 0.09; 'parsed': 0.09; 'raises': 0.09; 'subject:language': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '"lambda"': 0.16; '(note': 0.16; '24,': 0.16; 'figure,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'grep': 0.16; 'lambda': 0.16; 'mine.': 0.16; 'nodes': 0.16; 'subject: \n ': 0.16; 'wrote:': 0.18; 'library': 0.18; 'packages.': 0.19; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'instead.': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; "i've": 0.25; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'subject:list': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'easier': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'though.': 0.31; 'figure': 0.32; 'actual': 0.34; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'instances': 0.36; 'keyword': 0.36; 'done': 0.36; 'too': 0.37; 'two': 0.37; 'list': 0.37; 'files': 0.38; 'pm,': 0.38; 'does': 0.39; 'removing': 0.60; 'places': 0.64; 'mar': 0.68; 'to,': 0.72; 'counts': 0.83; 'subject:this': 0.83; '3.4': 0.84; 'cuts': 0.84; 'email name:steve': 0.84; 'respectable': 0.84; 'lazy': 0.91; 'to:none': 0.92; 'hundred': 0.95 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; bh=EgJiHs5O/Xd70MgGOduHCBECoGXrsL5YqQ9GWV0giNI=; b=mBNDs50tExco/WJC4NRx18h0ZyXsePjz+F1M2IKWaDTGtSibLKGDTNKiI7V7dSwBfL Gcv0lW2m54yR+apGDypDtVL9/WVms8DH+lnxXhL98e9ZMp2hiSdkFJ5mnLL/sA+IjzqK nKYPnJiEC/8EAmbqPS7oQLiK61FZdID44qL/FXj6WJpI9icdVMos1A4XDfR4kotxGmkX v/BUYWBsaZCCCkaeVegfUtKnCr+F7lQfDT3qMF+GMjLvx9QydpQ/ZTZzwWp8KoMNnoxW ztBBkSM3UTLWT6aDCzbUO8ZOGwf4Vqa2GG64fBMoaIH9+r+LFLjgdbCC15oi+kohzjoq 8a/Q== MIME-Version: 1.0 X-Received: by 10.66.27.202 with SMTP id v10mr8129137pag.127.1395660080394; Mon, 24 Mar 2014 04:21:20 -0700 (PDT) In-Reply-To: <532fffaf$0$29878$c3e8da3$5496439d@news.astraweb.com> References: <9daf0806-02de-4447-964c-c8f8953c23e5@googlegroups.com> <10101874-2995-4acd-9851-989603f052e3@googlegroups.com> <532d5bd9$0$29994$c3e8da3$5496439d@news.astraweb.com> <532fffaf$0$29878$c3e8da3$5496439d@news.astraweb.com> Date: Mon, 24 Mar 2014 22:21:20 +1100 Subject: Re: Explanation of this Python language feature? [x for x in x for x in x] (to flatten a nested list) From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395660083 news.xs4all.nl 2893 [2001:888:2000:d::a6]:60464 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68869 On Mon, Mar 24, 2014 at 8:49 PM, Steven D'Aprano wrote: > I'm too lazy to do this the > right way, but there are at least 99 mentions of "lambda" in the 3.3 > standard library: > > steve@runes:/usr/local/lib/python3.3$ grep lambda *.py | wc -l > 99 I'm not too lazy to do it the right way, but I don't have 3.3 handy, so I've done it on 3.4 instead. There are 77 instances of lambda nodes in the files you list there - which are the ones that aren't in packages. (Note that two instances of lambda on the same line would count as one in Steven's figure, but as two in mine. Also, his counts comments. Still, his way's a lot easier to calculate, and it's in the right ball-park.) Including all subdirectories raises that figure to, get this, 1230. That's actual uses of the lambda keyword as parsed by Python. This does include the test suite, though. Removing all files with "/test/" in the names cuts that figure to only 273. But that's still two hundred and seventy-three places where the Python standard library uses lambda - a respectable figure. ChrisA