Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!1.eu.feeder.erje.net!bcyclone05.am1.xlned.com!bcyclone05.am1.xlned.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.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.054 X-Spam-Evidence: '*H*': 0.89; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.05; 'okay': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'wrong,': 0.09; 'ball.': 0.16; 'lambda': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'uh,': 0.16; 'wrote:': 0.16; 'language': 0.19; '>>>': 0.20; 'greg': 0.22; 'lawrence': 0.22; 'referring': 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; 'header:X-Complaints-To:1': 0.26; 'chris': 0.26; "doesn't": 0.28; 'looks': 0.29; '~ethan~': 0.29; 'guess': 0.29; 'function': 0.30; "skip:' 10": 0.30; 'fri,': 0.31; 'skip:[ 10': 0.32; 'language.': 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; "didn't": 0.37; 'subject:: ': 0.37; 'thought': 0.37; 'received:org': 0.38; 'pm,': 0.39; 'to:addr:python.org': 0.39; 'takes': 0.39; 'where': 0.40; 'mark': 0.40; 'some': 0.40; 'your': 0.60; 'back': 0.61; 'hope': 0.61; 'today,': 0.62; 'our': 0.64; 'charset:windows-1252': 0.65; 'cut': 0.67; 'everybody': 0.67; 'home': 0.67; '26,': 0.72; 'chrisa': 0.84; 'pythonistas,': 0.84; 'careful': 0.91; 'ethan': 0.91; 'furman': 0.91; 'glove': 0.91; 'received:2': 0.93; 'hands': 0.96 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: converting boolean filter function to lambda Date: Fri, 26 Jun 2015 02:08:42 +0100 References: <558C256D.7080903@stoneleaf.us> <558CA373.2000409@stoneleaf.us> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-2-98-197-151.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <558CA373.2000409@stoneleaf.us> 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1435280934 news.xs4all.nl 2874 [2001:888:2000:d::a6]:39182 X-Complaints-To: abuse@xs4all.nl X-Received-Bytes: 4749 X-Received-Body-CRC: 326635458 Xref: csiph.com comp.lang.python:93174 On 26/06/2015 01:57, Ethan Furman wrote: > 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~ I takes it you're referring to the cissies game where everybody has to wear a glove just to catch the ball? And there's no seam to cut your hands if you get it wrong, so I guess they don't bother rubbing white spirit into the hands to help toughen them up? :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence