Path: csiph.com!optima2.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!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.058 X-Spam-Evidence: '*H*': 0.88; '*S*': 0.00; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'okay': 0.09; 'ball.': 0.16; 'lambda': 0.16; 'uh,': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'greg': 0.22; 'lawrence': 0.22; 'am,': 0.23; '2015': 0.23; "i've": 0.24; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'question': 0.26; 'chris': 0.26; "doesn't": 0.28; 'looks': 0.29; '~ethan~': 0.29; 'function': 0.30; "skip:' 10": 0.30; 'fri,': 0.31; 'skip:[ 10': 0.32; 'point': 0.33; "he's": 0.33; 'is?': 0.33; 'to:addr:python-list': 0.35; 'next': 0.35; 'done': 0.35; 'attempt': 0.35; 'besides': 0.35; 'list': 0.35; 'received:10': 0.37; "didn't": 0.37; 'subject:: ': 0.37; 'thought': 0.37; 'pm,': 0.39; 'to:addr:python.org': 0.39; 'mark': 0.40; 'some': 0.40; 'back': 0.61; 'hope': 0.61; 'today,': 0.62; 'charset:windows-1252': 0.65; 'home': 0.67; '26,': 0.72; 'chrisa': 0.84; 'received:10.1.10': 0.84; 'careful': 0.91; 'ethan': 0.91; 'furman': 0.91 Date: Thu, 25 Jun 2015 17:57:23 -0700 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: converting boolean filter function to lambda References: <558C256D.7080903@stoneleaf.us> In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1435280263 news.xs4all.nl 2879 [2001:888:2000:d::a6]:33478 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 3711 X-Received-Body-CRC: 2174190060 Xref: csiph.com comp.lang.python:93171 On 06/25/2015 05:09 PM, Mark Lawrence wrote: > On 26/06/2015 00:59, Chris Angelico wrote: >> On Fri, Jun 26, 2015 at 1:59 AM, Ethan Furman wrote: >>> My attempt at a lambda function fails: >>> >>> filter(lambda p: (p in c for c in contacts), main) >>> # ['291.792.9001', '291.792.9000'] >>> >>> Besides using a lambda ;) , what have I done wrong? >> >> This looks like a job for a list comprehension! >> >> (Cue the swooping-in cape-wearing list comp, coming to save the day) >> >> ChrisA >> > > In exactly the same way that swooping-in cape-wearing Greg Ewing, from the home of 10 man rugby, had to point out to Ethan some years back what "booted into touch" meant? :) > > I've also seen Ethan refer to bowlers today, I just hope he's very careful and doesn't get caught on the back foot. Next question from Ethan is? Uh, "caught on the back foot"? I thought I was okay as long as I didn't slide across the line or gutter the ball. ;) -- ~Ethan~