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


Groups > comp.lang.python > #39970 > unrolled thread

Re: groupby behaviour

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2013-02-26 09:53 -0700
Last post2013-02-26 09:53 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: groupby behaviour Ian Kelly <ian.g.kelly@gmail.com> - 2013-02-26 09:53 -0700

#39970 — Re: groupby behaviour

FromIan Kelly <ian.g.kelly@gmail.com>
Date2013-02-26 09:53 -0700
SubjectRe: groupby behaviour
Message-ID<mailman.2552.1361897635.2939.python-list@python.org>
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:
"""

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web