continue and break frustration

John Benson jsbenson at
Sun Dec 14 07:39:29 CET 2003

In reply to

  Message: 14
  Date: Sun, 14 Dec 2003 16:37:09 +1100
  From: Glen Wheeler <adsl5lcq at>
  Subject: continue and break frustration
  To: python-list at
  Message-ID: <lktntvcjvus05no6csnc4fnuph64qsuhdb at>
  Content-Type: text/plain; charset=us-ascii

    Hello All.

    I've been coding in python for a reasonable amount of time now
  (coding in total for approx. 20 years) and am writing a performance
  intensive program in python.
    The problem I'm having is I want to use break and continue to get
  out from more than one level of loop.  If I set a variable and then
  check it my program will take too much of a performance hit.
    Are there any alternatives people can think of?

How about raising an exception that can't be caught inside the
try:...except:... you want to catch it? (Note: this rules out catchall
except:s inside.)

More information about the Python-list mailing list