Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Michael Selik Newsgroups: comp.lang.python Subject: Re: Iteration, while loop, and for loop Date: Tue, 28 Jun 2016 13:58:12 +0000 Lines: 30 Message-ID: References: <079ff112-8f18-4a27-938f-12e4e55a4a5b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de 0hHkZZLtXNUs6lUEM6CmAAVyYdvaXODHUsYj1tG6W7Sw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.020 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'linear': 0.07; 'subject:while': 0.09; '2016': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'variable.': 0.16; 'wrote:': 0.16; '>': 0.18; 'email addr:gmail.com>': 0.18; 'variable': 0.18; 'to:2**1': 0.21; 'programming': 0.22; 'code.': 0.23; "python's": 0.23; 'second': 0.24; 'header:In-Reply-To:1': 0.24; "i've": 0.25; 'example': 0.26; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'looks': 0.29; 'url:wikipedia': 0.29; 'url:wiki': 0.30; 'fixed': 0.31; 'another': 0.32; 'michael': 0.33; 'tue,': 0.34; 'received:google.com': 0.35; 'according': 0.36; 'but': 0.36; 'skip:i 20': 0.36; 'url:org': 0.36; 'heard': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'being': 0.37; 'wanted': 0.37; 'skip:v 20': 0.38; 'someone': 0.38; 'why': 0.39; 'url:en': 0.39; 'to:addr:python.org': 0.40; 'elizabeth': 0.72; 'classed': 0.84; "op's": 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=dzWXM9Ik3dmIjtslxFQvof26KQ2pAZlWMXx164NHvJ4=; b=nKcM+8JDi5YvVyLFdBdaL4pCrKUaRRYz7YLPKgWDj7TCA8Wdf/hWgBXlKwbm4t45Os Lroj2Bx8PStlx4ADWYSK9XcAZZHdSOW2IjDJeowaA5qIbB+6kQj4XMVZI/XXHZHMooDz H1EKH8AKzNzsWTiqBqlai6bdWdyKO1073/lXVQeBAZwbcFaFTKSGoRaUfCS1lUeTk5bQ xnhwKIgFNunfw1IXd0ZGYDU+GhedaX0msZufcuK8KAeGotg3O0T2kyymQdPFYfjPEtmZ ILhocjfNmsYHnQ9t8lnvvJYAWlFeIwDB7fiMm3jfFG6HD1u6J/tgEIMrlZn+10LkqEii 99+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=dzWXM9Ik3dmIjtslxFQvof26KQ2pAZlWMXx164NHvJ4=; b=gEGWlxrChX5GpHSVpnGDxnercql950fUvPMug/R1QmlRS1Hq84VgzgrfoGVftShLB4 +JGIVL5EbXiOE7lmDHzJotdckjAl8P1OKfNCy8VdHD7C8yblk8gBK8+mNvhB3J4QKGyo r5SHxmvm7k5RTQPHQfH1jpkPQdK22O8NFYiyNClKccNTFDTDIk5XlwGYx9vwlKNDkc9J IMrD5EKn+Thf79OLl/Dg4D/oe4hH1EfiuxKJJ8aBkOjlHvocAz/SdDkjgS23Cnu9f5NK wwLXg7bVgUND4RGCR97w2sLX4DvnBTR1YkglJjrm6K8UcmfkFvCvJjcU4+MJ2rvLllon kCYA== X-Gm-Message-State: ALyK8tL+NasNpqL9XCYyOXByMoW97cmCDFxsqfGYny/2sOm006SPeV/a7iesa7cO+yW10SAtfCFg/pcUK90oyg== X-Received: by 10.237.39.167 with SMTP id a36mr1974171qtd.103.1467122301837; Tue, 28 Jun 2016 06:58:21 -0700 (PDT) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.22 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: X-Mailman-Original-References: <079ff112-8f18-4a27-938f-12e4e55a4a5b@googlegroups.com> Xref: csiph.com comp.lang.python:110699 On Tue, Jun 28, 2016 at 9:34 AM BartC wrote: > On 28/06/2016 14:15, Michael Selik wrote: > > On Tue, Jun 28, 2016 at 8:41 AM Elizabeth Weiss > wrote: > > > >> I do not understand the second code. What is counter? > >> > > > > It looks like someone wanted to make a loop induction variable. > > https://en.wikipedia.org/wiki/Induction_variable > > I don't know if that helps; I've never heard of an induction variable. > But you've seen them often in other programming languages? > And according to the first example in that link, then 'word' in the OP's > second example might be classed as an induction variable too! The variable ``word`` was not being incremented/decremented by a fixed amount, nor was it a linear function of another induction variable. > Confusing. Indeed. That's why Python's for-loops are preferable.