Generators and Iterators


Details
We are honored to present Ravi Chityala, works in Silicon Valley and also an instructor at the University of California Santa Cruz Extension. He has co-authored multiple books on Python and its libraries.
For today's event, Ravi is going to talk about Generators and Iterators in Python.
Generator functions and iterator objects are used to generate iterable objects, which as the name indicates are iterated (typically) using a loop to generate data. The reality is much more than this simple definition.
In this talk we will discuss the various features of generators and iterators that make them very powerful.
- memory efficiency
- ability to generate data lazily and only on demand
- ability to pipeline for efficiency
- suspend function execution and resume later which leads to the creation of co-operative routines or coroutines, which is the underlying programming model for concurrent programming using async-await.
The generators and iterators are useful for Python programmers of all flavors and learning about them will give us magical power.


Generators and Iterators