Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44087

Re: itertools.groupby

References <mailman.855.1366477790.3114.python-list@python.org> <atkvgbFto6uU1@mid.individual.net> <CAHVvXxTG2gfsjrfWAA3LZmAxymcfXHTc9ocb_T+FMU0fqBivJQ@mail.gmail.com>
Date 2013-04-23 01:14 +1000
Subject Re: itertools.groupby
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.925.1366643689.3114.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Apr 23, 2013 at 12:49 AM, Oscar Benjamin
<oscar.j.benjamin@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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

itertools.groupby Jason Friedman <jsf80238@gmail.com> - 2013-04-20 11:09 -0600
  Re: itertools.groupby Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-04-21 00:13 +0000
    Re: itertools.groupby Joshua Landau <joshua.landau.ws@gmail.com> - 2013-04-22 04:09 +0100
  Re: itertools.groupby Neil Cerutti <neilc@norwich.edu> - 2013-04-22 14:24 +0000
    Re: itertools.groupby Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-04-22 15:49 +0100
      Re: itertools.groupby Neil Cerutti <neilc@norwich.edu> - 2013-04-22 15:04 +0000
    Re: itertools.groupby Chris Angelico <rosuav@gmail.com> - 2013-04-23 01:14 +1000

csiph-web