Generator functions look like regular functions but they have one or more yield
statements within them. Unlike regular functions, the code within a generator function isn't run when you call it! Calling a generator function returns a generator object, which is a lazy iterable.
My name is Trey Hunner. I do corporate Python training for teams and I teach Python online through Python Morsels.
In Python Morsels, I publish a new Python screencast every week.
If you want to learn something new every week, join Python Morsels!
Join Python Morsels ✨