On Tue, Apr 23, 2013 at 12:49 AM, Oscar Benjamin
<oscar.j.benja...@gmail.com> wrote:
> Iterators are
> typically preferred over list slicing for sequential text file access
> since you can avoid loading the whole file at once. This means that
> you can process a large file while only using a constant amount of
> memory.

And, perhaps even more importantly, allows you to pipe text in and
out. Obviously some operations (eg grep) lend themselves better to
this than do others (eg sort), but with this it ought at least to
output each group as it comes.

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

Reply via email to