Skip to main content

2 docs tagged with "generator"

View all tags

Comprehensions

In Python, there are several types of comprehensions that can be used to create new data structures from existing ones:

Generator

In Python, a generator is a special type of function that can be used to create iterable sequences of values on-the-fly. Unlike regular functions, which compute and return a value immediately, generators can generate a sequence of values over time, using the yield keyword.