PyCon 2019 in Cleveland, Ohio

Wednesday 1:20 p.m.–4:40 p.m. in Room 19

Lazy Looping in Python: Making and Using Generators and Iterators

Trey Hunner


When processing large amounts of data in Python, we often reach for lists. Unfortunately, processing data using large lists make for ugly code that can be memory inefficient and slow. Python's solution to this problem is lazy looping using generators and iterators. During this tutorial we'll learn a number of lazy looping techniques which will help you write more efficient and more readable Python code. We'll get practice creating generators, playing with iterators, and using generators and iterators to drastically restructure our code in a more descriptive data-centric way. You'll walk out of this tutorial with hands-on experience with Python's various lazy looping constructs and a greater appreciation for how looping works under the hood in Python.

Student Handout

No handouts have been provided yet for this tutorial