Iterators and generators for the masses

kevin parks kp87 at lycos.com
Mon Feb 25 12:24:27 EST 2002


A note in my Python 2.2 folder says that:

Iterators (PEP 234) and generators (PEP 255) were added.

When I ask questions on the tutor list and also this list i get
answers that sometimes start:

...We can do this with Python's new generators...
...Python's new iterators make this easy...

Numerous searches turned up many complex PEPs, rewritten PEPs and 
wild drag-down knock out USENET geek fights over whether or not these
were
good and should be added to Python. Nothing I could make heads or
tails of.

Myself I am just getting used to seeing list comprehensions...

1> any chance that there will be tutorials on these important new
features added to www.python.org?(a *real* tutorial on list
comprehensions would be nice too, but at least there is documentation
on them on www.python.org)

2> Anyone up to explaining them here? (hopefully in a way that someone
other than Tim Peters and Guido understands! Insult me if you must --
talk to me like I am a 12 year old! Why? Because there are 12 year
olds out there learning Python and those of us with the
math/science/programming chops of a 12 year old who are also trying to
understand this stuff).

what do they do? what can they do, what tasks do they make easier,
what is the simplest possible example, what is a more complex
example...etc. & co.

cheers,
kevin parks
seoul, korea



More information about the Python-list mailing list