Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Grady Martin Newsgroups: comp.lang.python Subject: Re: for / while else doesn't make sense Date: Thu, 9 Jun 2016 08:50:32 -0400 Lines: 10 Message-ID: References: <20160609125032.GP1607@slim> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de 7hLkFT0z6yyz/jfEKSctwAvjbMmR9QGThNuGZrWpJ8wQ== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.027 X-Spam-Evidence: '*H*': 0.95; '*S*': 0.00; 'executed': 0.07; 'cc:addr :python-list': 0.09; 'subject:while': 0.09; 'instead.': 0.15; 'cc:name:python': 0.16; 'distinction': 0.16; 'elsewhere,': 0.16; 'false),': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:make': 0.16; 'wrote:': 0.16; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'header:In-Reply-To:1': 0.24; 'header :User-Agent:1': 0.26; 'sense': 0.26; 'not.': 0.27; 'received:209.85.214.46': 0.27; 'concise': 0.29; 'certain': 0.31; 'point': 0.33; 'view,': 0.33; 'received:google.com': 0.35; 'but': 0.36; 'should': 0.36; 'received:209.85': 0.36; '(i.e.': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'thank': 0.38; 'test': 0.39; 'received:209.85.214': 0.39; 'well.': 0.40; 'ever': 0.60; 'subject: / ': 0.63; 'enjoy': 0.66; 'construct': 0.84; 'subject:else': 0.84; 'subject:sense': 0.84; 'involved.': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Chk0kUQcmRwP7vLB/N83SM8d/diU4T67IDszTOg6ct4=; b=hkSHpQa714jMPC7T3LVRf/Y+MNzdqfYClYP1VyVf8J/C2U+x+JFjzIIZlJNqPTaYW2 yeowem+sgp4y+ejLSBFal0cucv5Sddxnf7iQg0TgoMO1SRvuXpqIetFqcR4Dj7F19VLY AdvNt5euPBT+gkQZ3RV0raDZMisHFmhPAQggx5CwE2WgP3TVFjhgm4B9WeHFQeLruiay dt1djuFfePg7yp0/0Fs2OVo7R0DAqzY2Po0qAlR7qM72dmHLjfgvB1g56zL50oNLd2ZT 6HUQgNlr0dMhiM74zYIGcV8KrLEzZHqwSksQ9sTnbcdK5YxrI8poQiPESKnJ82PgP6WD XQJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=Chk0kUQcmRwP7vLB/N83SM8d/diU4T67IDszTOg6ct4=; b=YXrKfylbpg7eklCzvcooXxYrX7eDr3J7zoumFoNrLT3mNRxNEFMJVrunjQYUIgT3U8 dtRZc0vVzHHAB5nCsotBpF1cR3I2UjAdga43YFjTGxIVYcBcDCKTPDjWNmpWCaFsp+l/ 8bs+v8fFaEK92uLZTJAYkUj8Qk3jCljFfIu08uZY9iMAzr946crsBukSYJdJWOvlHbP9 ec4TicPzrAQh2er5tbyJlz3NMf9EVFiPdFFn5/Lx367hUP/fpEYuA7EWtjHJ75LziZrz ylb8yPcFvXYPFGqV8L7x8nr7yKqZq8qKs2PAHYlDTzr2qCMAzv7vqVB9KCrJfdHXo22o Z0Xg== X-Gm-Message-State: ALyK8tLyKRwJEdoF7VAZpa6wLBZDkbNPRG/0uIvjbe8Wce+b2CJWbGmFDm4Uc+Avty+4Sw== X-Received: by 10.36.55.15 with SMTP id r15mr17485535itr.73.1465476634457; Thu, 09 Jun 2016 05:50:34 -0700 (PDT) X-Google-Original-From: Grady Martin Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-Mailman-Approved-At: Thu, 09 Jun 2016 08:53:21 -0400 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <20160609125032.GP1607@slim> X-Mailman-Original-References: Xref: csiph.com comp.lang.python:109739 On 2016年05月19日 11時02分, Ian Kelly wrote: >"else" makes sense from a certain point of view, but I think that >logic may not be communicated well. At the start of each loop >iteration, the loop construct makes a test for whether the loop should >continue or not. If that test ever fails (i.e. if the condition of the >while loop is false), the else block is executed instead. Thank you for the concise explanation. (I enjoy new tools.) As alluded to elsewhere, this distinction makes sense when loop breaking is involved.