> > I use "while True"-loops often, and intend to continue doing this > "while True", but I'm curious to know: how widespread is the > injunction against such loops?
The injunction is nonexistent (save perhaps in people coming from another language who insist that Python just /must/ have a "proper" do-while construct). "while True" with an exit-test at the end is idiomatic, how you spell "do-while" in Python. There's nothing at all wrong with it, and no real Python programmer will ever say don't-do-it. Okay, some people prefer to spell it 'while 1', but its the same difference. Yeah, you have to be certain the exit condition is there and properly formed so it can exit (unless you're using a generator which never empties, of course). But you have to make sure you have a proper exit condition on any looping construct anyways. No idea where your charge came across the advice, but its nonsense. Has it reached the status of "best > practice"? > Its simply the correct way to spell a do-while or intentionally infinite loop in Python, always has been. HTH, --S
-- http://mail.python.org/mailman/listinfo/python-list