Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39970
| References | <CAF_E5JasO841FBst9EtXJJEQkK54UELgBcAZk8GVyGHigxu8TQ@mail.gmail.com> |
|---|---|
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | 2013-02-26 09:53 -0700 |
| Subject | Re: groupby behaviour |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2552.1361897635.2939.python-list@python.org> (permalink) |
On Tue, Feb 26, 2013 at 9:27 AM, andrea crotti <andrea.crotti.0@gmail.com> wrote: > So I was trying to use groupby (which I used in the past), but I > noticed a very strange thing if using list on > the result: As stated in the docs: """ The returned group is itself an iterator that shares the underlying iterable with groupby(). Because the source is shared, when the groupby() object is advanced, the previous group is no longer visible. So, if that data is needed later, it should be stored as a list: """
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: groupby behaviour Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-26 09:53 -0700
csiph-web