Isaac To <[EMAIL PROTECTED]> writes: >>>>>> "Mike" == Mike Meyer <[EMAIL PROTECTED]> writes: > > Mike> I think it's a bit abnormal, because you have to scan the > Mike> loop body for breaks. I tend to write: > > Mike> condition = True > Mike> while condition: # corrected > Mike> #code which iterates my simulation > > Then you'd have to scan the loop body to find the location where > condition is set, which is more difficult than locating breaks > normally. If you get a break, you really breaks. If you set > condition to False, you still might be modifying it to True later in > your code. And of course, most editors will highlight the "break" for > you, while no editor will highlight for you the "condition" variable > that you are staring at.
Checking the condition and using a break at the bottom of the loop doesn't change any of these things, so my version is less work. In normal use, the "condition" is something that falls out of the operation - checking for an empty string on file in put, for example - and you can set the variable that is being tested to a value that causes the condition to be true. <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