Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.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.111 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.78; '*S*': 0.00; 'equivalent.': 0.09; 'terminate': 0.09; 'pm,': 0.11; 'wrote:': 0.14; 'expr': 0.16; 'none"': 0.16; 'otherwise,': 0.20; 'tue,': 0.20; 'header:In-Reply- To:1': 0.22; 'jason': 0.22; 'subject: -- ': 0.25; 'chris': 0.27; 'function': 0.27; 'message-id:@mail.gmail.com': 0.28; 'hey': 0.29; 'argue': 0.31; 'second': 0.31; 'to:addr:python-list': 0.32; 'point': 0.35; 'function.': 0.35; 'none': 0.36; 'received:209.85': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'but': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'would': 0.40; 'header:Received:5': 0.40; '2011': 0.62; 'said:': 0.68; '12:18': 0.84; '12:20': 0.84; '5.\xa0': 0.84; 'death!': 0.84; 'received:209.85.210.174': 0.84; 'received:mail- iy0-f174.google.com': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=wrA5ruC1xuAZyj0V5uJpp97N43H1ESVz00W7IcHA83I=; b=MvcMKyoemSN9VParv5QMZXRyhFtaKIu1yNRQlz6Fxg1zc7S8X2QgaWIEKBL7taIQ// M975oQGlEJGeCs6Ng+WNrX7V+SwptP0Dy2ZUOZ0am5ZvYc8YE8weUMoQdd9IVQyeG2vK KNvMsxfEEaTMqoBJt8BrIaq+/3GCq/r0tiUvM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=qFAx4hsg8gRdVjuX2ytYrhNgiqgJqud1z87s8dL9YYSeGhjaCHHiAv6okesMqnGYNh 1827uyniooQfMd5wWLKSoRUEhia5tLP0kdy2d0d2dkY0h1Mr2AfDjlP7wAZSiPuHt1Pu SOvpxMWEiTQSKE9MawP22KZO/fwAtm03MBcME= MIME-Version: 1.0 In-Reply-To: References: <8abff237-5ccd-4eb6-85c8-cdc9e87520b7@bl1g2000vbb.googlegroups.com> Date: Tue, 12 Apr 2011 12:44:19 +1000 Subject: Re: Feature suggestion -- return if true From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 18 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1302576262 news.xs4all.nl 81474 [::ffff:82.94.164.166]:58100 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3017 On Tue, Apr 12, 2011 at 12:20 PM, James Mills wrote: > On Tue, Apr 12, 2011 at 12:18 PM, Jason Swails w= rote: >> This is only true if n < 5.=A0 Otherwise, the first returns None and the >> second returns False. > > Which is why I said: > > return expr or None > > But hey let's argue the point to death! That's still not equivalent. "return expr or None" will always terminate the function. The OP's request was for something which would terminate the function if and only if expr is non-false. Chris Angelico