Jp Calderone writes:
> Anything can be a for loop.
>
>   for chunk in iter(lambda: f1.read(CHUNK_SIZE), ''):
>       f2.write(chunk)

Raymond responds:
> It would be nice to have this encapsulated in a file method:
>
>     for chunk in f1.iterblocks(CHUNK_SIZE):
>         f2.write(chunk)

What ever happened to "Not every 3 line function needs to be a builtin"?

It's a common pattern. It's easy to do. Where's the problem?

-- Michael Chermside

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to