Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12519

Re: fun with nested loops

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.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.039
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'value,': 0.04; 'exceptions': 0.09; 'top-level': 0.09; 'am,': 0.12; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:loops': 0.16; 'wrote:': 0.16; 'received:209.85.210.174': 0.18; 'received:mail-iy0-f174.google.com': 0.18; 'maybe': 0.21; 'header:In-Reply-To:1': 0.22; 'structure': 0.23; 'sep': 0.23; 'code': 0.25; 'skip:b 20': 0.26; 'loop': 0.28; 'thu,': 0.28; 'message-id:@mail.gmail.com': 0.29; 'not.': 0.30; 'rough': 0.30; 'ago': 0.31; 'proposed': 0.32; "isn't": 0.33; 'to:addr:python- list': 0.33; 'daniel': 0.34; 'google': 0.36; 'checks': 0.37; 'several': 0.37; 'but': 0.37; 'some': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'subject:with': 0.39; 'to:addr:python.org': 0.39; "i'd": 0.40; 'more': 0.60; 'your': 0.61; 'ever': 0.65; 'subject:fun': 0.67; 'strange': 0.68; 'deep,': 0.84; 'this...': 0.84; 'url:goto': 0.84
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; bh=4IYziwuMpZLrRuMiJvS7Ki2vVXxrTLI3TF34LWQp74c=; b=OzodS90ETqEla15XOxrltEOvnFXmAAQsG/1U2M+VE3u+GMwBwVuZGpDOUXjwo4mSUD XmIaunKDpLgCz0XBlO1e+BDPOjiN3uiqOlO7KHQ+V84RGSa92B5pRIJlpyoPhIbFc6oB zskPe+OEANHhmnw1AVmIu+qN2TO8uAH56N94E=
MIME-Version 1.0
In-Reply-To <0cc53b0e-d05b-42fd-96f2-8df6f767e66c@en1g2000vbb.googlegroups.com>
References <e544c1e4-7d5e-4688-bd92-dbb2cd4c179f@k9g2000vbd.googlegroups.com> <mailman.625.1314814411.27778.python-list@python.org> <0cc53b0e-d05b-42fd-96f2-8df6f767e66c@en1g2000vbb.googlegroups.com>
Date Thu, 1 Sep 2011 05:15:42 +1000
Subject Re: fun with nested loops
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.628.1314818144.27778.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1314818144 news.xs4all.nl 2476 [2001:888:2000:d::a6]:50588
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12519

Show key headers only | View raw


On Thu, Sep 1, 2011 at 5:07 AM, Daniel <dalist0@gmail.com> wrote:
>> Do you only ever have one top-level loop that you would be naming? If
> no, unfortunately not. The rough structure is several loops deep, and
> I need to break/continue/restart many of them.
> Continue is used more than break, because most of the time that I find
> some strange value, I'd just _continue_ a few levels up
> to restart the current measurements.
>

Ah well, was worth a try. Raising exceptions smells wrong for this,
but peppering your code with sentinel checks isn't much better. I
don't really know what would be a good solution to this... except
maybe this, which was proposed a few years ago and which I'd never
heard of until Google showed it to me just now:
http://entrian.com/goto/

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

fun with nested loops Daniel <dalist0@gmail.com> - 2011-08-31 08:51 -0700
  Re: fun with nested loops aspineux <aspineux@gmail.com> - 2011-08-31 09:35 -0700
    Re: fun with nested loops Daniel <dalist0@gmail.com> - 2011-08-31 11:40 -0700
      Re: fun with nested loops Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-01 10:11 +1000
        Re: fun with nested loops Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-01 10:50 +1000
          Re: fun with nested loops Daniel <dalist0@gmail.com> - 2011-09-01 07:05 -0700
            Re: fun with nested loops Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-09-01 16:57 +0200
            Re: fun with nested loops Terry Reedy <tjreedy@udel.edu> - 2011-09-01 14:40 -0400
            Re: fun with nested loops Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-02 11:04 +1000
  Re: fun with nested loops Chris Angelico <rosuav@gmail.com> - 2011-09-01 04:13 +1000
    Re: fun with nested loops Daniel <dalist0@gmail.com> - 2011-08-31 12:07 -0700
      Re: fun with nested loops Chris Angelico <rosuav@gmail.com> - 2011-09-01 05:15 +1000
        Re: fun with nested loops Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-09-01 10:18 +1000
  Re: fun with nested loops Carl Banks <pavlovevidence@gmail.com> - 2011-09-01 12:02 -0700
    Re: fun with nested loops Daniel <dalist0@gmail.com> - 2011-09-01 17:21 -0700

csiph-web