Iterators & Generators: Basics and beyond

Rajat Goyal (~rajat)




Outline of the talk:

  • Traditional loops in python
  • Iterators
    • What are they
    • How do they work
    • Why should you use them
  • Iteration protocol
    • next()
    • StopIteration exception
  • Common occurrences of iterators in standard library
  • How to make iterators
  • How to make objects of your class iterable
  • Generators
  • Generator expressions
  • Co-relation between iterables, iterators & generators
  • How to make generators
  • Common loop expressions and how to replace them with iterators
  • Pitfalls to avoid with iterators
  • Iterators in Django
  • Itertools & Boltons Libraries


Basic knowledge of Python 3

Content URLs:

To be updated

Speaker Info:

I'm a freelancer, earning my living by writing Python code for the last two years.

Speaker Links:




Section: Core Python
Type: Talks
Target Audience: Beginner
Last Updated:

Good explanation of the tools present in itertools library would be very much appreciated. Raymond hettinger, a popular pycon speaker keeps mentioning about it but I never got around to it.

Abhas Bhattacharya (~bendtherules)

Login to add a new comment.