Generators¶
Generators are a simpler way to create iterators. They use the yield keyword to produce a series of values lazily, which means they generate values on the fly and do not store them on memory.
Pratica usage:
- Read large files without store they entirely in memory
0
1
4
9
16
Reached the end of the generator.