Python Developer — Easy
Key points
- Generators produce values one at a time
- They use the yield keyword to return values
- Generators do not load all values into memory at once
- Iterating over a generator is more memory-efficient than creating a list
- Generators are useful for working with large datasets
Ready to go further?
Related questions
