Looping constructs
beej at piratehaven.org
beej at piratehaven.org
Mon Dec 24 11:27:25 EST 2001
In article <3C2602B3.47EA5685 at engcorp.com>,
Peter Hansen <peter at engcorp.com> wrote:
>I, for one, find it much easier to start my loop
>with "while 1:" and then stick the logic where it needs
>to be with "if xxxx: break"
Do you ever have a "while 0:" loop? Of course not. So why is there
even a conditional in there at all? Shouldn't Python just have a:
foreverloop: # do-while, repeat-until
do_stuff()
if condition: break
foreverloop: # while
if condition: break
do_stuff()
No, because that's ugly. (Or maybe yes because it's minimalistic?)
I'm one of those Python newcomers who thinks the set of looping
statements is a little too rarified. :) But whatever, I'll keep using
it.
-Beej, sure I'm covering old ground
More information about the Python-list
mailing list