Simon Willison’s Weblog

Python iterators

Via Daily Python-URL (which appears not to provide permalinks): Introduction to Python iterators. This is an extract from Deitel & Deitel’s “Python How To Program” and includes extensive code samples. Iterators are very cool—as I see it, they allow you to overload an object ready for use with Python’s powerful for ... in ... syntax (as well as other looping methods). This blog is implemented as an object in PHP—had I used Python I could display the whole blog using for entry in blog: print entry.

This is Python iterators by Simon Willison, posted on 15th June 2002.

Next: Learning from smart tags

Previous: Meg on blogging

Previously hosted at http://simon.incutio.com/archive/2002/06/15/pythonIterators