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


Groups > comp.lang.python > #12512

Re: fun with nested loops

References <e544c1e4-7d5e-4688-bd92-dbb2cd4c179f@k9g2000vbd.googlegroups.com>
Date 2011-09-01 04:13 +1000
Subject Re: fun with nested loops
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.625.1314814411.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Sep 1, 2011 at 1:51 AM, Daniel <dalist0@gmail.com> wrote:
>
> Has anyone an idea on a nice way to write breaks/continues/redos for
> deeply
> nested loops?
>

Do you only ever have one top-level loop that you would be naming? If
so, put that loop into a function and use return instead of break.
Unfortunately that doesn't work for continue.

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