Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!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.050 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'syntax': 0.04; 'guido': 0.05; 'explicit': 0.07; 'indexing': 0.07; 'subject:PEP': 0.07; "'no": 0.09; 'terminated': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'early.': 0.16; 'itertools': 0.16; 'elements': 0.16; 'so.': 0.16; 'separate': 0.22; 'cc:addr:python.org': 0.22; '(or': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; '>': 0.26; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'said,': 0.30; 'code': 0.31; 'ones.': 0.31; 'community': 0.33; 'maybe': 0.34; 'problem': 0.35; 'there': 0.35; 'largely': 0.36; 'charset:us-ascii': 0.36; 'list': 0.37; 'rather': 0.38; 'skip:u 10': 0.60; 'subject:? ': 0.60; 'from:no real name:2**0': 0.61; 'break': 0.61; 'new': 0.61; 'range': 0.61; 'header:Message-Id:1': 0.63; 'kind': 0.63; 'different': 0.65; 'benefit': 0.68; 'applying': 0.72; 'special': 0.74; 'subject:this': 0.83; "'for'": 0.84; "'while'": 0.84; 'received:172.29.51.203': 0.84; 'received :mtaomg-db05.r1000.mx.aol.com': 0.84; 'yours': 0.88; 'notion': 0.91 References: <8D03F2B8CF0E7BE-1864-1796B@webmail-m103.sysops.aol.com> To: nhodgson@iinet.net.au Subject: Is this PEP-able? fwhile In-Reply-To: X-MB-Message-Source: WebUI MIME-Version: 1.0 From: jimjhb@aol.com X-MB-Message-Type: User Content-Type: multipart/alternative; boundary="--------MB_8D03FACACF6D9FC_D84_73DC6_webmail-vm008.sysops.aol.com" X-Mailer: AOL Webmail 37834-STANDARD X-Originating-IP: [71.205.231.93] Date: Tue, 25 Jun 2013 07:17:12 -0400 (EDT) x-aol-global-disposition: G DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mx.aol.com; s=20121107; t=1372159033; bh=eBKY1Yw/YRDOEo2NyRlvJHvuGDsMY+NsWeVfD1LAYOE=; h=From:To:Subject:Message-Id:Date:MIME-Version:Content-Type; b=nA4PTXeA9VEZqFZpbe5MPhgyzBSX77YlDz2hYYdBR1w7H93wrjGNtI7m9+zTSDQd7 4RRg5MK2QjJqxiJNOeQ9cg7rsU8Wz/AgbkoQkkaLPx7hz8ICrGV4f6ZJKt8Vr/F2q/ R+Kpn5bF1Qsjd2rtglEZOYvhXv+4vkmD394RBQcs= X-AOL-SCOLL-SCORE: 0:2:359804992:93952408 X-AOL-SCOLL-URL_COUNT: 0 x-aol-sid: 3039ac1d33cb51c97c3849e9 Cc: python-list@python.org 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: 111 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372159042 news.xs4all.nl 15886 [2001:888:2000:d::a6]:55361 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49144 This is a multi-part message in MIME format. ----------MB_8D03FACACF6D9FC_D84_73DC6_webmail-vm008.sysops.aol.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" > Syntax: > fwhile X in ListY and conditionZ: There is precedent in Algol 68: for i from 0 to n while safe(i) do .. od which would also make a python proposal that needs no new key words: for i in range(n) while safe(i): .. The benefit of the syntax would be to concentrate the code=20 expressing the domain of the loop rather than have it in separate locations= . Not a big win in my opinion. Neil Neil, I disagree. The problem IMO is that python 'for's are a different kind of '= for' in that they have no explicit indexing and no explicit range test; jus= t a list which has elements drawn from it. This is amazingly=20 powerful and concise. Unfortunately, the "breaks are just gotos" community= often ruins this conciseness by going to 'while' or itertools (or worse) t= o avoid adding a break to a 'for' which needs to be terminated early. I think suggestions like yours and Fabio's are good ones. If 'for' has an = 'else', why not a 'while'? FWIW, I can sympathize with the 'no breaks or continues' notion, at least l= argely so. That said, I have used gotos sparingly in C. The problem is th= at applying the no-breaks notion to the python 'for' is problematic because= as I said earlier, the python 'for' is a special kind of 'for'. Maybe Gui= do needs to be seen in public hugging a break statement..... :) ----------MB_8D03FACACF6D9FC_D84_73DC6_webmail-vm008.sysops.aol.com Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="us-ascii"

> Syntax:
> fwhile X in ListY and conditionZ:

    There is precedent in Algol 68:

for i from 0 to n while safe(i) do .. od

    which would also make a python proposal that needs no ne= w key words:

for i in range(n) while safe(i): ..

    The benefit of the syntax would be to concentrate the co= de
expressing the domain of the loop rather than have it in separate locations= .

    Not a big win in my opinion.

    Neil

Neil,
 
I disagree. The problem IMO is that python 'for's are a different kind= of 'for' in that they have no explicit indexing and no explicit range test= ; just a list which has elements drawn from it.  This is amazingly
powerful and concise.  Unfortunately, the "breaks are just gotos"= community often ruins this conciseness by going to 'while' or itertools (o= r worse) to avoid adding a break to a 'for' which needs to be terminated ea= rly.
 
I think suggestions like yours and Fabio's are good ones.  If 'fo= r' has an 'else', why not a 'while'?
 
FWIW, I can sympathize with the 'no breaks or continues' notion, at le= ast largely so.  That said, I have used gotos sparingly in C.  Th= e problem is that applying the no-breaks notion to the python 'for' is prob= lematic because as I said earlier, the python 'for' is a special kind of 'f= or'.  Maybe Guido needs to be seen in public hugging a break statement= .....  :)
----------MB_8D03FACACF6D9FC_D84_73DC6_webmail-vm008.sysops.aol.com--