Peter Hansen <[EMAIL PROTECTED]> writes: > Sybren Stuvel wrote: >> Mike Meyer enlightened us with: >> >>>>I dislike gotos because it is too easy to inadvertently create >>>>infinite loops. <10 WINK; 20 GOTO 10> >>> >>>And it's impossible without them? <while True: pass> >> I thought the same thing, but then I read it again and thought about >> the "inadvertently". As soon as you see a "while True", you _know_ >> it's going to loop forever. > > Unless it doesn't, of course: > > while True: > break
My "favorite" infinte loop with while is: i = 0 while i < 20: do_process(i) Note the prominent *lack* of any change to i here? Oh, for: from i = 0 invariant 0 <= i <= 20 variant 21 - i until i > 19 loop do_process(i) which throws an exception at the beginning of the second loop. <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list