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


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

Re: learning to use iterators

Started bySeb <spluque@gmail.com>
First post2014-12-23 13:37 -0600
Last post2014-12-23 13:37 -0600
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: learning to use iterators Seb <spluque@gmail.com> - 2014-12-23 13:37 -0600

#82851 — Re: learning to use iterators

FromSeb <spluque@gmail.com>
Date2014-12-23 13:37 -0600
SubjectRe: learning to use iterators
Message-ID<mailman.17162.1419363455.18130.python-list@python.org>
On Tue, 23 Dec 2014 12:23:45 -0700,
Ian Kelly <ian.g.kelly@gmail.com> wrote:

> The parentheses enclose a generator expression, which is similar to a
> list comprehension [1] but produce a generator, which is a type of
> iterator, rather than a list.

> In much the same way that a list comprehension can be expanded out to
> a for loop building a list, another way to specify a generator is by
> defining a function using the yield keyword. For example, this
> generator function is equivalent to the generator expression above:

[...]

Thank you, this exactly what I was missing.

Happy holidays,

-- 
Seb

[toc] | [standalone]


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


csiph-web