Closed john-science closed 8 years ago
It would be nice to add a section on iterators somewhere... but where? Taking the Next Step? Std Libs 1?
I just need to define an iterator, show examples, define a generator, show xrange
and xreadlines
examples, and then show how to use yield
to create your own generator.
There are lost of good references for this to point the student at:
And don't forget to mention the Python 2 versus Python 3 difference with xrange
and xreadlines
.
I should add the keyword "yield" somewhere. Is there somewhere it won't clutter eveything up? Probably not. Still, it's super useful.