Iteratoration question

Diez B. Roggisch deets at nospam.web.de
Fri Apr 3 10:11:32 CEST 2009


> 
> while what you are doing is interesting, it is not the same as Python's
> iterators, which use "yield" from a function and don't require storing a
> value in a class.  look for "yield" in the python docs.  this comment may
> be irrelevant; i am just worried you are confusing the above (which apart
> from the mistake about instances is perfectly ok) and python's iterators
> (which use next(), yield, etc).

You are confusing generators with the iterator-protocol. Iteration has 
been part of python long before generators appeared on the scene.

Diez



More information about the Python-list mailing list