On Wed, Oct 24, 2012 at 2:40 PM, Dan Loewenherz <dloewenh...@gmail.com> wrote: > So I'm sure a lot of you have run into the following pattern. I use it > all the time and it always has felt a bit awkward due to the duplicate > variable assignment. > > VAR = EXPR > while VAR: > BLOCK > VAR = EXPR
The idiomatic way to do this is: while True: VAR = EXPR if not VAR: break BLOCK -- http://mail.python.org/mailman/listinfo/python-list