"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] || | But loops that run at least once is a basic element of algorithms. | Perhaps not as common as the zero or more times of the while loop, but | still fundamental. It is a shame it has to be faked using: | | while True: # force the first iteration to always run | process | if condition: break | | Ugly and misleading.
I disagree. Nothing is being faked. The generic loop is while True: pre_process if condition: break post_process If there is no pre_process, abbreviate the first two lines as 'while condition:'. If there is no post_process, some would like another abbreviation. Understanable. But the use cases seem relatively few. And anyway, a competant programmer must understand the generic loop and a fraction form, which I believe is at least as common as the no post_process case. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list