Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #49101
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.109.133.86.MISMATCH!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.008 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'languages,': 0.04; 'syntax': 0.04; 'anyway.': 0.05; 'model,': 0.05; 'subject:PEP': 0.07; 'idea?': 0.09; 'python': 0.11; 'language,': 0.12; '(int': 0.16; '24,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'generators.': 0.16; 'introduces': 0.16; 'loops': 0.16; 'nesting': 0.16; 'omitting': 0.16; 'rule.': 0.16; 'all.': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'adds': 0.24; 'exists': 0.24; 'mon,': 0.24; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; "doesn't": 0.30; 'said,': 0.30; 'message-id:@mail.gmail.com': 0.30; '25,': 0.31; 'probably': 0.32; "we're": 0.32; 'actual': 0.34; 'maybe': 0.34; 'could': 0.34; 'point.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'are,': 0.36; 'clear': 0.37; 'implement': 0.38; 'ahead': 0.38; 'to:addr :python-list': 0.38; 'pm,': 0.38; 'rather': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; 'ian': 0.60; 'subject:? ': 0.60; 'new': 0.61; 'simply': 0.61; 'more': 0.64; 'taking': 0.65; 'here': 0.66; 'benefit': 0.68; 'lose': 0.68; 'lack': 0.78; 'gain': 0.79; 'subject:this': 0.83; 'afford': 0.91; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=DLHeTFtsZd8hU/6IUU/qfEQjptQ/Ag5SQod4aWPx4g4=; b=YWORNI8lp2fSK4TjpoSR1U4woRvJPnpLZkVZQ/mI1t5jXdSDVfv9AoXXEIKC6c59FM MZg52WNsGKXo0ZuixpXDV3lrVPjW6Uvj22eVy9JySqjCQWM6BOUStmGYG2/lBkFadqst HjTvuC/RGLQMd8EMCsHbwa5se47fT01GLTXEcJCPJyxl7XqePRVUVtgX//nV8RacGGHl ZVVzzPRzFWfPwWU6FunCyy4YGrj+9lsUyVoSx1VppQ4vIyF2w49RViKfuwJJRmtmnKxG Hm+vuXiOT8x8u484bfqnL3t1BupV/t1zGHueIxuEw/DuzmFfqr3bVHHDesWAaXiWac8S 4IzQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.220.48.17 with SMTP id p17mr12195215vcf.97.1372114242824; Mon, 24 Jun 2013 15:50:42 -0700 (PDT) |
| In-Reply-To | <CALwzid=4_dicyJ4RAFZ=vAXMTkvPqiauWoyfqjr7frFnaEXatA@mail.gmail.com> |
| References | <8D03F2B8CF0E7BE-1864-1796B@webmail-m103.sysops.aol.com> <CAA=1kxR65wqgQWQJaLvP2yx_XacEMsHiFs40rPW1UbFXYpnytA@mail.gmail.com> <CALwzidnADsCdNmfFsLChVq7bt9G87Rsr1DsD1M-jNmzqQ2Z0eA@mail.gmail.com> <CAA=1kxR2JU7tbNdr9smZd9=Cy-vSCwoaAzwM=6LiAZ3edzrF8A@mail.gmail.com> <CALwzid=4_dicyJ4RAFZ=vAXMTkvPqiauWoyfqjr7frFnaEXatA@mail.gmail.com> |
| Date | Tue, 25 Jun 2013 08:50:42 +1000 |
| Subject | Re: Is this PEP-able? fwhile |
| From | Chris Angelico <rosuav@gmail.com> |
| 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.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3782.1372114251.3114.python-list@python.org> (permalink) |
| Lines | 45 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1372114251 news.xs4all.nl 15949 [2001:888:2000:d::a6]:59864 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:49101 |
Show key headers only | View raw
On Tue, Jun 25, 2013 at 8:43 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Mon, Jun 24, 2013 at 4:41 PM, Fábio Santos <fabiosantosart@gmail.com> wrote:
>>
>> On 24 Jun 2013 22:29, "Ian Kelly" <ian.g.kelly@gmail.com> wrote:
>>>
>>> On Mon, Jun 24, 2013 at 2:34 PM, Fábio Santos <fabiosantosart@gmail.com>
>>> wrote:
>>> > This can probably be best achieved by adding to the existing for loop,
>>> > so maybe taking advantage of the existing for...if syntax and adding
>>> > for...while would be a better idea?
>>>
>>> The for...if syntax only exists for comprehensions and generators. If
>>> we're going to add for...while for loops, then we might as well go
>>> ahead and add for...if loops there as well.
>>>
>>> That said, I do like this syntax better than "fwhile".
>>
>> Good point. Still, I don't see why for..if doesn't exist in for loops
>> anyway. It may be lack of foresight, but I don't understand why at all.
>
> Because it adds more syntax to learn when learning the language, it
> introduces more maintenance overhead, and it offers no clear benefit
> over simply nesting an if inside a for.
In more free-form languages, I implement this by simply omitting a line-break:
for (int i=0;i<num_whatevers;++i) if (whatever[i].flag)
{
do_stuff;
}
Python could afford to lose a little rigidity here rather than gain
actual new syntax:
for i in range(10): if i%3:
print(i)
And there you are, the for-if "filtered iteration" model, just by
relaxing one rule.
ChrisA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Is this PEP-able? fwhile Chris Angelico <rosuav@gmail.com> - 2013-06-25 08:50 +1000
csiph-web