What Are Python Generators?
Learn the basics of creating and using generators. In order to understand how
asyncio works, it is important to have a basic understanding of how generators work. In this lesson, you’ll learn how to turn a regular function into a generator using the
You’ll also see a couple of examples like the one below that show how to create and use a generator to make a sequence of values.
def odds(start, stop): for odd in range(start, stop + 1): yield odd
Become a Member to join the conversation.