Speaker Deck

The Vanishing Pattern: from iterators to generators in Python

by Luciano Ramalho

Published July 25, 2013 in Technology

The core of the talk is refactoring a simple iterable class from the classic Iterator design pattern (as implemented in the GoF book) to compatible but less verbose implementations using generators. This provides a meaningful context to understand the value of generators. Along the way the behavior of the iter function, the Sequence protocol and the Iterable interface are presented. The motivating examples of this talk are database applications.