Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!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; 'else:': 0.03; 'context': 0.05; 'clause': 0.07; 'missed': 0.09; 'semantics': 0.09; 'sentence': 0.09; 'cc:addr:python-list': 0.10; '"break"': 0.16; '(assuming': 0.16; 'benjamin': 0.16; 'blocks': 0.16; 'cc:name:python list': 0.16; 'evaluating': 0.16; 'expect,': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'equivalent': 0.20; 'meant': 0.21; 'statement': 0.23; 'cc:2**1': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'common': 0.26; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'behaviour': 0.29; 'equivalent.': 0.29; 'piece': 0.29; 'stuff': 0.30; 'point': 0.31; 'version': 0.34; 'received:google.com': 0.34; 'received:209.85': 0.35; 'two': 0.37; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'think': 0.40; 'your': 0.60; 'side': 0.61; 'different': 0.63; 'subject:...': 0.63; 'more': 0.63; 'realise': 0.65; '2013': 0.84; 'oscar': 0.84; 'mistake': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=S7uI9MeI26zkORXHOWRchrklxFKBpSIQvrKnkztT7rg=; b=D+Tk5soR6+6l2rjp7NqspIlg+yeUj8xF5hlfqX8lHUVqyH52wdTx46kZXM1OTXRphv FWop8f6ARXDxTKHBjKz4IigdlPqeoU2g9s3aQfsroG9GGjv0vhkeUySxlrqq4OtSUQZq k8xrDEYekWjvzh6QllagIEdItbqVf6sF5IJylltpMRRWQLot2PHeEBdPi018rvWxPtGu W/grmSg5lBe8IW0d8EFGT86xJXFzNFV5DAu8BeovlbNkCXfOY+EL/xMNIAT/1fwW3Is2 XIkb0xI8Q/NMZR55EN6kS4jR/UWyUnNAlL4rMIx8sxTs4FY8onld4JqEcGYE6K+w31+B p6Pw== MIME-Version: 1.0 X-Received: by 10.224.58.66 with SMTP id f2mr1384741qah.11.1358939911341; Wed, 23 Jan 2013 03:18:31 -0800 (PST) In-Reply-To: References: <50FEF1F5.9050501@stoneleaf.us> Date: Wed, 23 Jan 2013 11:18:31 +0000 Subject: Re: Understanding while...else... From: Oscar Benjamin To: =?UTF-8?B?UmVuw6kgS2xhxI1hbg==?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Python List , Terry Reedy 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: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358939920 news.xs4all.nl 6954 [2001:888:2000:d::a6]:35746 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37450 On 23 January 2013 11:03, Ren=C3=A9 Kla=C4=8Dan wro= te: > On Wed, Jan 23, 2013 at 1:39 AM, Oscar Benjamin wrote: You missed off an important piece of context in your post: >> I think he meant that he would use the else clause more often if it >> had the semantics so that the two blocks below were equivalent: The key word in that sentence is "if". >> # Version 1 >> while condition: >> # stuff >> else: >> # other stuff >> >> # Version 2 >> if condition: >> while condition: >> # stuff >> else: >> # other stuff > > they wouldnt be equivalent if #staff in version did not cointain "break" > statement and this is common mistake I realise that they are not equivalent. My point was that some people expect, or would prefer, different behaviour so that those two *would* be equivalent (assuming that evaluating "condition" doesn't have side effects). Oscar