Okay, Thanks guys.
That explains it. Cheers, T -------- Original-Nachricht -------- > Datum: Tue, 14 Jul 2009 00:16:30 -0700 > Von: wesley chun <wes...@gmail.com> > An: "A.T.Hofkamp" <a.t.hofk...@tue.nl> > CC: Todd Matsumoto <tmatsum...@gmx.net>, "tutor@python.org" <tutor@python.org> > Betreff: Re: [Tutor] While and for loops > >> So how would you break out from this situation? > > > > finished = False > > while not finished: > > <do something> > > for i in items: > > if i > 10: > > finished = True # Do not do the next while-iteration > > break # and break out of the for loop > > else: > > <do something> > > > this solution is workable as well, plus it avoids having 2 break > statements in the code. it "breaks" out of the while-loop in a natural > way, making its conditional False. > > -- wesley > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > "Python Web Development with Django", Addison Wesley, (c) 2009 > http://withdjango.com > > wesley.j.chun :: wescpy-at-gmail.com > python training and technical consulting > cyberweb.consulting : silicon valley, ca > http://cyberwebconsulting.com -- Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor