variable assignment in "while" loop

Anders J. Munch andersjm at dancontrol.dk
Tue Jul 29 11:41:06 EDT 2003


"Aahz" <aahz at pythoncraft.com> wrote:
> 
> Peter usually gives a good answer, but this time there's a better
> answer:

With a bug, but if we combine Peter's answer with yours we get an
even better answer:

def fetch_iter(mydbcursor):
    while 1:
        info = mydbcursor.fetchone()
        if not info:
            break
        yield info

- Anders






More information about the Python-list mailing list