learning to use iterators
Seb
spluque at gmail.com
Tue Dec 23 14:37:16 EST 2014
On Tue, 23 Dec 2014 12:23:45 -0700,
Ian Kelly <ian.g.kelly at 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
More information about the Python-list
mailing list