Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'level,': 0.07; 'alternatives': 0.09; 'attributes': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'rejected': 0.09; 'jan': 0.12; 'hypothetical': 0.16; 'indent': 0.16; 'option:': 0.16; 'readability': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'redundant': 0.16; 'reedy': 0.16; 'rejected.': 0.16; 'sequence:': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'options': 0.25; 'second': 0.26; 'certain': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'testing': 0.29; "d'aprano": 0.31; 'option.': 0.31; 'steven': 0.31; 'subject:end': 0.31; 'option': 0.32; 'problem': 0.35; 'except': 0.35; 'tool': 0.35; 'something': 0.35; 'but': 0.35; 'really': 0.36; 'instances': 0.36; 'sequence': 0.36; 'saves': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'short': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'days': 0.60; 'ago,': 0.61; 'received:173': 0.61; 'more': 0.64; 'fourth': 0.84; 'gains': 0.84; 'received:fios.verizon.net': 0.84; 'absolutely': 0.87; 'have.': 0.93; 'incredibly': 0.96 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: semicolon at end of python's statements Date: Sat, 31 Aug 2013 01:03:35 -0400 References: <1377735506.18906.15.camel@debian> <1FETt.52607$Mw4.14965@fx15.am4> <7wob8gywds.fsf@benfinney.id.au> <52213435$0$6599$c3e8da3$5496439d@news.astraweb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: <52213435$0$6599$c3e8da3$5496439d@news.astraweb.com> 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: 43 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1377925439 news.xs4all.nl 15941 [2001:888:2000:d::a6]:39072 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:53321 On 8/30/2013 8:09 PM, Steven D'Aprano wrote: > We really are spoiled for choice here. We can write any of these: > > # Option 1 > for spam in sequence: > if predicate(spam): > process(spam) > > # Option 2 > for spam in filter(predicate, sequence): > process(spam) > > # Option 3 > for spam in (spam for spam in sequence if predicate(spam)): > process(spam) > > > Adding a fourth option: > > for spam in sequence if predicate(spam): > process(spam) > > saves absolutely nothing except a line and an indent level, neither of > which are in short supply, and gains nothing in readability over Option 1. Which is why it has been rejected. > But of all the options shown, including the hypothetical for...if, I > still prefer Option 1, or Option 2 as my second option. Ditto. I think people would be better off spending more time learning more about how to use this incredibly powerful tool we have and less arguing for rejected redundant alternatives to what we do have. Just a few days ago, after 16 years of Python, I learned something really neat about function attributes of instances that made a certain testing problem disappear. -- Terry Jan Reedy