Generator expressions vs. comprehensions

Antoine Pitrou solipsis at pitrou.net
Mon May 24 19:50:48 EDT 2010


On Mon, 24 May 2010 15:47:32 -0700 (PDT)
Carl Banks <pavlovevidence at gmail.com> wrote:
> >
> > Is this distinction generally known?

Yes, it is.

> > The generator expression
> > behavior is understandable since a generator would do the same thing,
> > but I'm disappointed that the inconsistency exists and wasn't fixed in
> > Python 3 when we had the chance.

Why don't you use itertools.islice()?






More information about the Python-list mailing list