Am 25.03.2012 15:03 schrieb Tim Chase:
Perhaps a DB example
works better. With assignment allowed in an evaluation, you'd be able to
write

while data = conn.fetchmany():
    for row in data:
        process(row)

whereas you have to write

while True:
    data = conn.fetchmany()
    if not data: break
    for row in data:
        process(row)

Or simpler

for data in iter(conn.fetchmany, []):
    for row in data:
        process(row)

provided that a block of rows is returned as a list - which might be different among DB engines.


Thomas
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to