Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: for / while else doesn't make sense Date: Tue, 7 Jun 2016 17:11:19 -0600 Lines: 22 Message-ID: References: <7d453116-c02a-4211-836e-518f571c29a3@googlegroups.com> <4aafb237-4c41-4c0f-98ec-f71841c36bc1@googlegroups.com> <48de4319-7c8a-419a-978c-3cff46f3490a@googlegroups.com> <57524448$0$1615$c3e8da3$5496439d@news.astraweb.com> <12226874-a705-47b1-859c-e9bed59ac6bb@googlegroups.com> <6c3b3d2e-bfc0-4c0e-ab81-55ec672f06c9@googlegroups.com> <7eb86c69-e0c5-4a4e-b35e-d8404bbebf9f@googlegroups.com> <878tyj97zo.fsf@elektro.pacujo.net> <6fde6944-918a-443e-b44f-0c7a69604a44@googlegroups.com> <1da21ea9-cfa8-4fae-960c-e753c9cc185e@googlegroups.com> <4a643983-c64e-483a-8e23-3c1485b89475@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de ELmd8M2q2uLJSCg9R+iicw1yxq+IyRGZgaQoPgV9W0+Q== 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; 'lines,': 0.05; 'counting': 0.07; 'remaining': 0.07; 'stack.': 0.07; 'excluding': 0.09; 'sporadic': 0.09; 'subject:while': 0.09; 'received:209.85.218': 0.10; 'stack': 0.13; '2016': 0.16; 'mine.': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:make': 0.16; 'twice.': 0.16; 'wow,': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'posted': 0.21; 'function,': 0.22; 'lawrence': 0.22; 'simpler': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'example': 0.26; 'checking': 0.27; 'message-id:@mail.gmail.com': 0.27; 'opposed': 0.27; 'long.': 0.29; 'that.': 0.30; 'code': 0.30; 'version,': 0.30; "can't": 0.32; 'maybe': 0.33; 'getting': 0.33; 'tue,': 0.34; 'received:google.com': 0.35; 'exist': 0.35; 'but': 0.36; 'lines': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'done.': 0.37; 'received:209': 0.38; 'to:addr:python.org': 0.40; 'where': 0.40; 'your': 0.60; 'identify': 0.61; 'subject: / ': 0.63; "they're": 0.66; 'huh?': 0.84; 'subject:else': 0.84; 'subject:sense': 0.84; 'to:name:python': 0.84; 'you\xe2\x80\x99re': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=dUAzY1QJCqHW46s0wp9wKydn86+MdLbYN3jryxywnAw=; b=oQHpyYtWV+OpXGO9qRM4gupB/3EWQgjOTV2uPvrRUJBLPmzm8DcHC2E610irT16OiM ygeh+k7WwLQalIHIM+y6Ivejjr01pc5vo/aKS2d0wZp1JOAmlnrVL29OhY2WurfUZbHj gQNZgCVBnQtgDRBKiEAvK+s0dbja903p5jgfZ04qlN8qO5yeWJ8+ffmwPZm5+r8jfg1S UrH/EOC0GZU2ZLIXDmB+htk7EXilQK59jagki5av5wWjQYLv01r84ob+zW7UtqG/Q2M9 tTSEsiksA6hEgxOmT866mrSE1h67TuGP1+81P+7aXZu4KDJ4EX9d4gd1bSzutBgT0bDV ms9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=dUAzY1QJCqHW46s0wp9wKydn86+MdLbYN3jryxywnAw=; b=jfUAuPPvQULRiM0OSNKdbMgiiSOGh6pb6NvLDpKNOET+0Ys1/p0eaPtoVh8MpKJ/gI w/Hiou/ZgH+nINRKtepwvdGDs3uiQYbMSTX3N/ufSCIiEPoAW0JfeAUXAxo2vgBWEUFL Pyqn2YHTxsxdpBm6BD0IuMelSWVZQQdh4hF84QF6cM0kXEZDz0yobtrhnfSp9p6OsuiX LZjBPUY9AkIC1spRkLZ789R9GHR2t4DtH0L8sPqqLsqYevQCcRAcvWPNDmo4yFJQS1pT pWJVgm+NjBOd6hTcCAWfPMv7L4bUPcCfWCQmmGsO95mwIcY6oh3+byE4/jqP/kcFFbiP yL2g== X-Gm-Message-State: ALyK8tLsvviOpvJRWoO4EjizpPibUwJi972njp9rrwZ+dw3jRLKbjWbN9pdGtP8TS6ZU7MieU1FFZUAzOCl1dA== X-Received: by 10.157.54.98 with SMTP id w89mr1132479otb.187.1465341119246; Tue, 07 Jun 2016 16:11:59 -0700 (PDT) In-Reply-To: <4a643983-c64e-483a-8e23-3c1485b89475@googlegroups.com> 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: <7d453116-c02a-4211-836e-518f571c29a3@googlegroups.com> <4aafb237-4c41-4c0f-98ec-f71841c36bc1@googlegroups.com> <48de4319-7c8a-419a-978c-3cff46f3490a@googlegroups.com> <57524448$0$1615$c3e8da3$5496439d@news.astraweb.com> <12226874-a705-47b1-859c-e9bed59ac6bb@googlegroups.com> <6c3b3d2e-bfc0-4c0e-ab81-55ec672f06c9@googlegroups.com> <7eb86c69-e0c5-4a4e-b35e-d8404bbebf9f@googlegroups.com> <878tyj97zo.fsf@elektro.pacujo.net> <6fde6944-918a-443e-b44f-0c7a69604a44@googlegroups.com> <1da21ea9-cfa8-4fae-960c-e753c9cc185e@googlegroups.com> <4a643983-c64e-483a-8e23-3c1485b89475@googlegroups.com> Xref: csiph.com comp.lang.python:109640 On Tue, Jun 7, 2016 at 3:58 PM, Lawrence D=E2=80=99Oliveiro wrote: > On Tuesday, June 7, 2016 at 11:53:46 PM UTC+12, Ian wrote: >> On Tue, Jun 7, 2016 at 1:52 AM, Lawrence D=E2=80=99Oliveiro wrote: > >>> Wow, that=E2=80=99s only twice the length of the code you=E2=80=99re re= placing. Well done. >> >> Huh? The example that you posted was 17 lines, excluding comments. My >> replacement code is 17 lines, excluding comments. Where are you >> getting "twice the length" from? > > Maybe not twice. But your code for dealing with the include stack was 16 = lines, as opposed to 13 in mine. Well, I don't know how you're counting that. All the code for dealing with the include stack is in the generate_lines function, which is 10 lines long. The remaining code is then simpler for not having to deal with it. In the original version, I can't identify which lines are "dealing with the include stack" because they're so intertwined. For example, all the sporadic code checking for line =3D=3D None or line !=3D None only need to exist because of the include stack.