Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'subject:when': 0.07; 'python': 0.08; 'exited': 0.09; 'received:10.50': 0.09; 'programmer': 0.10; 'am,': 0.12; 'confusing.': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'likewise': 0.16; 'syntactic': 0.16; 'then:': 0.16; 'syntax': 0.16; 'wed,': 0.17; 'wrote:': 0.18; 'received:209.85.210.174': 0.21; 'received:mail- iy0-f174.google.com': 0.21; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'suite,': 0.23; 'structure': 0.26; 'message- id:@mail.gmail.com': 0.29; '24,': 0.29; 'syntax,': 0.30; 'break': 0.32; 'too': 0.33; 'steven': 0.34; 'subject:/': 0.34; 'to:addr :python-list': 0.35; 'however,': 0.35; 'run': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.38; 'think': 0.38; 'should': 0.38; 'johnson': 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.40; 'header:Received:6': 0.61; '29,': 0.73; 'expects': 0.84 Received-SPF: pass (google.com: domain of rosuav@gmail.com designates 10.50.207.72 as permitted sender) client-ip=10.50.207.72; Authentication-Results: mr.google.com; spf=pass (google.com: domain of rosuav@gmail.com designates 10.50.207.72 as permitted sender) smtp.mail=rosuav@gmail.com; dkim=pass header.i=rosuav@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=zz03IwO7YbxCGbNNwPuSgqLBvLDNyLknIwEaDHEPUhE=; b=AJUCf8SBMRgPPftL5/8CkSUUJKi90MmM4wB5KY5wP9CfrHOwScHYMw18bqCU3Juwvg ohEMtWPqf3Ew1NXnm2HoHCOW10ygTDkV2TimbWXXOXK9b9gBfroaXGhBySRR3JHoKsQF GDo+piQ+3j7l0/BewkkMv5lfIH2toaQWXmons= MIME-Version: 1.0 In-Reply-To: References: <14ba4b39-4066-4d24-89d7-3c7c85aab85c@b18g2000vbz.googlegroups.com> <51a08251-1e6e-45f3-8531-b53e87b7db8b@r1g2000yqk.googlegroups.com> <4f47a49e$0$29989$c3e8da3$5496439d@news.astraweb.com> Date: Wed, 29 Feb 2012 10:24:18 +1100 Subject: Re: A quirk/gotcha of for i, x in enumerate(seq) when seq is empty From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1330471462 news.xs4all.nl 6903 [2001:888:2000:d::a6]:59009 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:21014 On Wed, Feb 29, 2012 at 9:56 AM, Rick Johnson wrote: > On Feb 24, 8:54=A0am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: > >> In Python 4000, I think for loops should be spelled: >> >> for name in iterable: >> =A0 =A0 # for block >> then: >> =A0 =A0 # only if not exited with break >> else: >> =A0 =A0 # only if iterable is empty >> >> and likewise for while loops. > > I like this syntax better than the current syntax, however, it is > STILL far too confusing! Absolutely, it's FAR too confusing. Every syntactic structure should have the addition of a "foo:" suite, which will run when the programmer expects it to and no other time. This would solve a LOT of problems. ChrisA