In article <mailman.4823.1388720985.18130.python-l...@python.org>,
 Chris Angelico <ros...@gmail.com> wrote:

> while (var = func())
> {
>     ....
> }
> 
> In Python, that gets a lot clunkier. The most popular way is to turn
> it into an infinite loop:
> 
> while True:
>     var = func()
>     if not var: break
>     ....

Or turn it into a generator:

def funcinator():
   while True:
      var = func()
      if var:
         yield var
      else:
         break

for var in funcinator():
   ....

That certainly makes your mainline code cleaner, but it's a lot of crud 
when all you really wanted to write was:

while func() as var:
   ....
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to