Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.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.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'received:209.85.213.46': 0.07; 'received:mail-yw0-f46.google.com': 0.07; 'snippets': 0.09; 'to:name:python list': 0.09; 'def': 0.13; 'am,': 0.14; 'wrote:': 0.14; 'valueerror': 0.16; 'tue,': 0.20; 'saying': 0.22; 'header :In-Reply-To:1': 0.22; 'received:209.85.213': 0.23; 'subject: -- ': 0.25; 'equivalent': 0.26; 'message-id:@mail.gmail.com': 0.28; 'raise': 0.29; 'solved': 0.31; 'to:addr:python-list': 0.32; 'none': 0.36; 'two': 0.37; 'received:209.85': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'how': 0.39; 'header:Received:5': 0.40; '2011': 0.62; 'skip:\xc2 10': 0.83; 'edwards': 0.91 MIME-Version: 1.0 In-Reply-To: References: <8abff237-5ccd-4eb6-85c8-cdc9e87520b7@bl1g2000vbb.googlegroups.com> From: James Mills Date: Tue, 12 Apr 2011 12:12:12 +1000 Subject: Re: Feature suggestion -- return if true To: python list Content-Type: text/plain; charset=UTF-8 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: 29 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1302574355 news.xs4all.nl 41113 [::ffff:82.94.164.166]:40254 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:3013 On Tue, Apr 12, 2011 at 11:44 AM, Grant Edwards w= rote: > How is that the same? > > =C2=A0return? something() =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0return something() or None > =C2=A0return? somethingelse() =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0return somethingelse() or None > =C2=A0log("didn't find an answer") =C2=A0 =C2=A0 =C2=A0 =C2=A0 log("didn'= t find an answer") > =C2=A0raise ValueError =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 raise ValueError > > Are you saying the two snippets above are equivalent? def foo(n): x =3D n < 5 if x: return x is functionally equivalent to: def foo(n): return n < 5 --=20 -- James Mills -- -- "Problems are solved by method"