Jean-Paul Calderone wrote: > When I just want the dumb version, I tend to write this: > > for chunk in iter(lambda: f.read(blocksize), ''): ... > > Which is only very slightly longer than your version. I would like it > even more if iter() had been written with the impending doom of lambda > in mind, so that this would work: > > for chunk in iter('', f.read, blocksize): ... > > But it's a bit late now.
How about this instead (will work in 2.5): for chunk in iter(partial(f.read, blocksize), ''): ... -- Benji York -- http://mail.python.org/mailman/listinfo/python-list